diff options
| -rw-r--r-- | pretyping/tacred.ml | 6 | ||||
| -rw-r--r-- | test-suite/success/change.v | 7 |
2 files changed, 12 insertions, 1 deletions
diff --git a/pretyping/tacred.ml b/pretyping/tacred.ml index 39015d89a9..f0d0d45267 100644 --- a/pretyping/tacred.ml +++ b/pretyping/tacred.ml @@ -943,6 +943,8 @@ let matches_head env sigma c t = | Proj (p, _) -> ConstrMatching.matches env sigma c (mkConst p) | _ -> raise ConstrMatching.PatternMatchingFailure +let is_pattern_meta = function Pattern.PMeta _ -> true | _ -> false + let e_contextually byhead (occs,c) f env sigma t = let (nowhere_except_in,locs) = Locusops.convert_occs occs in let maxocc = List.fold_right max locs 0 in @@ -960,7 +962,9 @@ let e_contextually byhead (occs,c) f env sigma t = else not (Int.List.mem !pos locs) in incr pos; if ok then - let subst' = Id.Map.map (traverse envc) subst in + let subst' = + if is_pattern_meta c then subst + else (* progress is ensured *) Id.Map.map (traverse envc) subst in let evm, t = f subst' env !evd t in (evd := evm; t) else if byhead then diff --git a/test-suite/success/change.v b/test-suite/success/change.v index 7bed7ecb15..f775f818ab 100644 --- a/test-suite/success/change.v +++ b/test-suite/success/change.v @@ -38,3 +38,10 @@ Fail change True with (let (x,a) := ex_intro _ True (eq_refl True) in x). Fail change True with match ex_intro _ True (eq_refl True) with ex_intro x _ => x end. Abort. + +(* Check absence of loop in identity substitution (was failing up to + Sep 2014, see #3641) *) + +Goal True. +change ?x with x. +Abort. |
