diff options
| author | Maxime Dénès | 2017-05-24 02:34:51 +0200 |
|---|---|---|
| committer | Maxime Dénès | 2017-05-24 02:34:51 +0200 |
| commit | 05add9c71214bebf86f1892c5ad946cdce19009a (patch) | |
| tree | 2a2526bc9ba06a9ff94ffe79cfea06c1baa84ea5 | |
| parent | 79ed0a7c7db8669d2a2037dbbd192192f2f8cc2f (diff) | |
| parent | 5c68b57c37c23a3b7b2afe4f6ff073568c7b8db9 (diff) | |
Merge PR#650: Fixing an extra bug with pattern_of_constr
| -rw-r--r-- | pretyping/patternops.ml | 5 | ||||
| -rw-r--r-- | test-suite/success/change.v | 9 |
2 files changed, 12 insertions, 2 deletions
diff --git a/pretyping/patternops.ml b/pretyping/patternops.ml index a22db1407b..638e12d7c1 100644 --- a/pretyping/patternops.ml +++ b/pretyping/patternops.ml @@ -155,14 +155,15 @@ let pattern_of_constr env sigma t = | Construct (sp,u) -> PRef (canonical_gr (ConstructRef sp)) | Proj (p, c) -> pattern_of_constr env (EConstr.Unsafe.to_constr (Retyping.expand_projection env sigma p (EConstr.of_constr c) [])) - | Evar (evk,ctxt) -> + | Evar (evk,ctxt as ev) -> (match snd (Evd.evar_source evk sigma) with | Evar_kinds.MatchingVar (b,id) -> assert (not b); PMeta (Some id) | Evar_kinds.GoalEvar | Evar_kinds.VarInstance _ -> (* These are the two evar kinds used for existing goals *) (* see Proofview.mark_in_evm *) - PEvar (evk,Array.map (pattern_of_constr env) ctxt) + if Evd.is_defined sigma evk then pattern_of_constr env (Evd.existential_value sigma ev) + else PEvar (evk,Array.map (pattern_of_constr env) ctxt) | _ -> PMeta None) | Case (ci,p,a,br) -> diff --git a/test-suite/success/change.v b/test-suite/success/change.v index 1f0b7d38a9..a9821b027f 100644 --- a/test-suite/success/change.v +++ b/test-suite/success/change.v @@ -59,3 +59,12 @@ unfold x. (* check that n in 0+n is not interpreted as the n from "fun n" *) change n with (0+n). Abort. + +(* Check non-collision of non-normalized defined evars with pattern variables *) + +Goal exists x, 1=1 -> x=1/\x=1. +eexists ?[n]; intros; split. +eassumption. +match goal with |- ?x=1 => change (x=1) with (0+x=1) end. +match goal with |- 0+1=1 => trivial end. +Qed. |
