aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Herbelin2016-12-05 12:12:39 +0100
committerHugo Herbelin2017-03-23 22:13:57 +0100
commitd2830ca4adf062df96d5e8978d4254cf5ece30c4 (patch)
tree074648d6905075241dd8fdebf057e0a7b3b5beb8
parentac655f3c8eb348b84c5ba3e3ed41977d36849ea5 (diff)
Supporting arbitrary binders in record fields, including e.g. patterns.
-rw-r--r--parsing/g_constr.ml47
-rw-r--r--test-suite/success/record_syntax.v8
2 files changed, 10 insertions, 5 deletions
diff --git a/parsing/g_constr.ml4 b/parsing/g_constr.ml4
index 22d4c68c35..e461db85f9 100644
--- a/parsing/g_constr.ml4
+++ b/parsing/g_constr.ml4
@@ -44,9 +44,6 @@ let binder_of_name expl (loc,na) =
let binders_of_names l =
List.map (binder_of_name Explicit) l
-let binders_of_lidents l =
- List.map (fun (loc, id) -> binder_of_name Explicit (loc, Name id)) l
-
let mk_fixb (id,bl,ann,body,(loc,tyc)) =
let ty = match tyc with
Some ty -> ty
@@ -229,8 +226,8 @@ GEXTEND Gram
;
record_field_declaration:
- [ [ id = global; params = LIST0 identref; ":="; c = lconstr ->
- (id, mkCLambdaN (!@loc) (binders_of_lidents params) c) ] ]
+ [ [ id = global; bl = binders; ":="; c = lconstr ->
+ (id, mkCLambdaN (!@loc) bl c) ] ]
;
binder_constr:
[ [ "forall"; bl = open_binders; ","; c = operconstr LEVEL "200" ->
diff --git a/test-suite/success/record_syntax.v b/test-suite/success/record_syntax.v
index db2bbb0dc7..07a5bc0606 100644
--- a/test-suite/success/record_syntax.v
+++ b/test-suite/success/record_syntax.v
@@ -45,3 +45,11 @@ Record Foo := { foo : unit; }.
Definition foo_ := {| foo := tt; |}.
End E.
+
+Module F.
+
+Record Foo := { foo : nat * nat -> nat -> nat }.
+
+Definition foo_ := {| foo '(x,y) n := x+y+n |}.
+
+End F.