diff options
| author | Pierre-Marie Pédrot | 2019-10-02 09:31:29 +0200 |
|---|---|---|
| committer | Pierre-Marie Pédrot | 2019-10-29 13:48:57 +0100 |
| commit | 5651d47395c1a88b8d5a1549f14c99f81bbcb551 (patch) | |
| tree | 8f674737cb1dce8b91f1f8930047ee155c994baf /test-suite | |
| parent | 5370e79c1128dd96a75e3c37569daa3fd98dcd86 (diff) | |
Fix #10615: Notation substitution for Ltac2 terms.
We implement a new type of "preterms" that represent untyped ASTs, corresponding
to glob_expr in the ML implementations. Ltac2 quotations inside notations are
provided with such preterms, and have to pretype them in order to do anything
of relevance with them.
Diffstat (limited to 'test-suite')
| -rw-r--r-- | test-suite/ltac2/term_notations.v | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/test-suite/ltac2/term_notations.v b/test-suite/ltac2/term_notations.v new file mode 100644 index 0000000000..85eb858d4e --- /dev/null +++ b/test-suite/ltac2/term_notations.v @@ -0,0 +1,33 @@ +Require Import Ltac2.Ltac2. + +(* Preterms are not terms *) +Fail Notation "[ x ]" := $x. + +Section Foo. + +Notation "[ x ]" := ltac2:(Control.refine (fun _ => Constr.pretype x)). + +Goal [ True ]. +Proof. +constructor. +Qed. + +End Foo. + +Section Bar. + +(* Have fun with context capture *) +Notation "[ x ]" := ltac2:( + let c () := Constr.pretype x in + refine constr:(forall n : nat, n = ltac2:(Notations.exact0 true c)) +). + +Goal forall n : nat, [ n ]. +Proof. +reflexivity. +Qed. + +(* This fails currently, which is arguably a bug *) +Fail Goal [ n ]. + +End Bar. |
