From 1f11c1f1366b4c82e2e596b3cc97ee0052189741 Mon Sep 17 00:00:00 2001 From: Matthieu Sozeau Date: Mon, 23 Jun 2014 18:29:07 +0200 Subject: Fix for bug 1951, allowing at least fully-applied inductives types to be used for building polymorphic instances of template polymorphic inductives. --- pretyping/pretyping.ml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'pretyping') diff --git a/pretyping/pretyping.ml b/pretyping/pretyping.ml index 2c16c2eb35..27abdbade8 100644 --- a/pretyping/pretyping.ml +++ b/pretyping/pretyping.ml @@ -590,10 +590,13 @@ let rec pretype resolve_tc (tycon : type_constraint) env evdref lvar t = match evar_kind_of_term !evdref resj.uj_val with | App (f,args) -> let f = whd_evar !evdref f in - if is_template_polymorphic env f then + if isInd f && is_template_polymorphic env f then + (* Special case for inductive type applications that must be + refreshed right away. *) let sigma = !evdref in let c = mkApp (f,Array.map (whd_evar sigma) args) in - let t = Retyping.get_type_of env sigma c in + let c = evd_comb1 (Evarsolve.refresh_universes true env) evdref c in + let t = Retyping.get_type_of env !evdref c in make_judge c (* use this for keeping evars: resj.uj_val *) t else resj | _ -> resj -- cgit v1.2.3