From 5c68b57c37c23a3b7b2afe4f6ff073568c7b8db9 Mon Sep 17 00:00:00 2001 From: Hugo Herbelin Date: Fri, 19 May 2017 12:20:19 +0200 Subject: Fixing an extra bug with pattern_of_constr. Ensure in type constr_pattern that those preexisting existential variables of the goal which do not contribute as pattern variables are expanded: constr_pattern is not observed up to evar expansion (like EConstr does), so we need to pre-normalize defined evars in patterns to that matching against an EConstr works. --- pretyping/patternops.ml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'pretyping/patternops.ml') diff --git a/pretyping/patternops.ml b/pretyping/patternops.ml index a22db1407..638e12d7c 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) -> -- cgit v1.2.3