diff options
| -rw-r--r-- | pretyping/unification.ml | 6 | ||||
| -rw-r--r-- | test-suite/bugs/closed/shouldsucceed/2817.v | 3 |
2 files changed, 6 insertions, 3 deletions
diff --git a/pretyping/unification.ml b/pretyping/unification.ml index 27e5864b35..cda1621e2f 100644 --- a/pretyping/unification.ml +++ b/pretyping/unification.ml @@ -397,7 +397,8 @@ let unify_0_with_initial_metas (sigma,ms,es as subst) conv_at_top env cv_pb flag check_compatibility curenv substn tyM tyN); if k2 < k1 then sigma,(k1,cN,stN)::metasubst,evarsubst else sigma,(k2,cM,stM)::metasubst,evarsubst - | Meta k, _ -> + | Meta k, _ + when not (dependent cM cN) (* helps early trying alternatives *) -> if wt && flags.check_applied_meta_types then (let tyM = Typing.meta_type sigma k in let tyN = get_type_of curenv sigma cN in @@ -410,7 +411,8 @@ let unify_0_with_initial_metas (sigma,ms,es as subst) conv_at_top env cv_pb flag (k,lift (-nb) cN,snd (extract_instance_status pb))::metasubst, evarsubst) else error_cannot_unify_local curenv sigma (m,n,cN) - | _, Meta k -> + | _, Meta k + when not (dependent cN cM) (* helps early trying alternatives *) -> if wt && flags.check_applied_meta_types then (let tyM = get_type_of curenv sigma cM in let tyN = Typing.meta_type sigma k in diff --git a/test-suite/bugs/closed/shouldsucceed/2817.v b/test-suite/bugs/closed/shouldsucceed/2817.v index 25ac15574c..08dff99287 100644 --- a/test-suite/bugs/closed/shouldsucceed/2817.v +++ b/test-suite/bugs/closed/shouldsucceed/2817.v @@ -5,4 +5,5 @@ Goal forall (f: nat -> nat -> Prop) (x:bool) (H0: forall x0, f (if x then x0 else x0) x0), False. -intros; apply H in H0. (* crashes *) +intros. +Fail apply H in H0. (* should fail without exhausting the stack *) |
