aboutsummaryrefslogtreecommitdiff
path: root/pretyping/glob_ops.ml
diff options
context:
space:
mode:
authorEmilio Jesus Gallego Arias2019-02-19 18:07:19 +0100
committerEmilio Jesus Gallego Arias2019-02-19 18:07:19 +0100
commitc3cc72ccf586703ed009a8bdd5df8d40b0384ab2 (patch)
tree06a68b153c71a5cd8caf57572ffb59e52f507265 /pretyping/glob_ops.ml
parent6e3850ce5092d5cb432ef917ae6ee79225089f6a (diff)
parenta8a26c87d52c30e5e5d1ba76f1920e8bc68bcd45 (diff)
Merge PR #9297: Two fixes in printing notations with patterns
Reviewed-by: ejgallego Ack-by: herbelin Reviewed-by: mattam82
Diffstat (limited to 'pretyping/glob_ops.ml')
-rw-r--r--pretyping/glob_ops.ml10
1 files changed, 8 insertions, 2 deletions
diff --git a/pretyping/glob_ops.ml b/pretyping/glob_ops.ml
index 6b61b1452e..68626597fc 100644
--- a/pretyping/glob_ops.ml
+++ b/pretyping/glob_ops.ml
@@ -485,7 +485,11 @@ let is_gvar id c = match DAst.get c with
| GVar id' -> Id.equal id id'
| _ -> false
-let rec cases_pattern_of_glob_constr na = DAst.map (function
+let rec cases_pattern_of_glob_constr na c =
+ (* Forcing evaluation to ensure that the possible raising of
+ Not_found is not delayed *)
+ let c = DAst.force c in
+ DAst.map (function
| GVar id ->
begin match na with
| Name _ ->
@@ -498,6 +502,8 @@ let rec cases_pattern_of_glob_constr na = DAst.map (function
| GApp (c, l) ->
begin match DAst.get c with
| GRef (ConstructRef cstr,_) ->
+ let nparams = Inductiveops.inductive_nparams (fst cstr) in
+ let _,l = List.chop nparams l in
PatCstr (cstr,List.map (cases_pattern_of_glob_constr Anonymous) l,na)
| _ -> raise Not_found
end
@@ -505,7 +511,7 @@ let rec cases_pattern_of_glob_constr na = DAst.map (function
(* A canonical encoding of aliases *)
DAst.get (cases_pattern_of_glob_constr na' b)
| _ -> raise Not_found
- )
+ ) c
open Declarations
open Term