aboutsummaryrefslogtreecommitdiffhomepage
path: root/interp/constrextern.ml
diff options
context:
space:
mode:
authorGravatar Hugo Herbelin <Hugo.Herbelin@inria.fr>2017-08-21 23:01:04 +0200
committerGravatar Hugo Herbelin <Hugo.Herbelin@inria.fr>2018-02-20 10:03:06 +0100
commit50970e4043d73d9a4fbd17ffe765745f6d726317 (patch)
tree30af940838c330d2b50a2da6c669667c23dfc7fc /interp/constrextern.ml
parent15abe33f55b317410223bd48576fa35c81943ff9 (diff)
Using an "as" clause when needed for printing irrefutable patterns.
Example which is now reprinted as parsed: fun '((x,y) as z) => (y,x)=z
Diffstat (limited to 'interp/constrextern.ml')
-rw-r--r--interp/constrextern.ml6
1 files changed, 4 insertions, 2 deletions
diff --git a/interp/constrextern.ml b/interp/constrextern.ml
index 013f5713e..67e19d125 100644
--- a/interp/constrextern.ml
+++ b/interp/constrextern.ml
@@ -924,7 +924,8 @@ and sub_extern inctx (_,scopes) = extern inctx (None,scopes)
and factorize_prod scopes vars na bk aty c =
match na, DAst.get c with
| Name id, GCases (LetPatternStyle, None, [(e,(Anonymous,None))],[(_,(_,[p],b))])
- when is_gvar id e && not (occur_glob_constr id b) ->
+ when is_gvar id e ->
+ let p = if occur_glob_constr id b then set_pat_alias id p else p in
let b = extern_typ scopes vars b in
let p = extern_cases_pattern_in_scope scopes vars p in
let binder = CLocalPattern (c.loc,(p,None)) in
@@ -946,7 +947,8 @@ and factorize_prod scopes vars na bk aty c =
and factorize_lambda inctx scopes vars na bk aty c =
match na, DAst.get c with
| Name id, GCases (LetPatternStyle, None, [(e,(Anonymous,None))],[(_,(_,[p],b))])
- when is_gvar id e && not (occur_glob_constr id b) ->
+ when is_gvar id e ->
+ let p = if occur_glob_constr id b then set_pat_alias id p else p in
let b = sub_extern inctx scopes vars b in
let p = extern_cases_pattern_in_scope scopes vars p in
let binder = CLocalPattern (c.loc,(p,None)) in