aboutsummaryrefslogtreecommitdiff
path: root/vernac
diff options
context:
space:
mode:
authorMaxime Dénès2019-02-13 21:53:15 +0100
committerMaxime Dénès2019-02-13 21:53:15 +0100
commit64eaf184df8ca52b7254a03e3b4f87c3c0491fdd (patch)
tree4abe81d9b619baeeb844a3a3b653a27086ddbf67 /vernac
parentaa2d7486702433c94bfd645d3a5f6575a9ee729f (diff)
parent737ae4816a9c84369bc1c0a0b359a9fd4f63dbe6 (diff)
Merge PR #9450: Fix #9432: canonical structure and coercion accept universe binders.
Ack-by: SkySkimmer Reviewed-by: Zimmi48 Ack-by: gares Reviewed-by: maximedenes
Diffstat (limited to 'vernac')
-rw-r--r--vernac/g_vernac.mlg18
1 files changed, 10 insertions, 8 deletions
diff --git a/vernac/g_vernac.mlg b/vernac/g_vernac.mlg
index 0664e18130..42bee25da3 100644
--- a/vernac/g_vernac.mlg
+++ b/vernac/g_vernac.mlg
@@ -693,18 +693,20 @@ GRAMMAR EXTEND Gram
LIST1 [ v=strategy_level; "["; q=LIST1 smart_global; "]" -> { (v,q) } ] ->
{ VernacSetStrategy l }
(* Canonical structure *)
- | IDENT "Canonical"; IDENT "Structure"; qid = global ->
- { VernacCanonical CAst.(make ~loc @@ AN qid) }
- | IDENT "Canonical"; IDENT "Structure"; ntn = by_notation ->
+ | IDENT "Canonical"; OPT [ IDENT "Structure" -> {()} ]; qid = global; ud = OPT [ u = OPT univ_decl; d = def_body -> { (u,d) } ] ->
+ { match ud with
+ | None ->
+ VernacCanonical CAst.(make ~loc @@ AN qid)
+ | Some (u,d) ->
+ let s = coerce_reference_to_id qid in
+ VernacDefinition ((NoDischarge,CanonicalStructure),((CAst.make (Name s)),u),d) }
+ | IDENT "Canonical"; OPT [ IDENT "Structure" -> {()} ]; ntn = by_notation ->
{ VernacCanonical CAst.(make ~loc @@ ByNotation ntn) }
- | IDENT "Canonical"; IDENT "Structure"; qid = global; d = def_body ->
- { let s = coerce_reference_to_id qid in
- VernacDefinition ((NoDischarge,CanonicalStructure),((CAst.make (Name s)),None),d) }
(* Coercions *)
- | IDENT "Coercion"; qid = global; d = def_body ->
+ | IDENT "Coercion"; qid = global; u = OPT univ_decl; d = def_body ->
{ let s = coerce_reference_to_id qid in
- VernacDefinition ((NoDischarge,Coercion),((CAst.make (Name s)),None),d) }
+ VernacDefinition ((NoDischarge,Coercion),((CAst.make (Name s)),u),d) }
| IDENT "Identity"; IDENT "Coercion"; f = identref; ":";
s = class_rawexpr; ">->"; t = class_rawexpr ->
{ VernacIdentityCoercion (f, s, t) }