Debian Codegraph @

test-suite/ltac2/term_notations.v

raw
1 Require Import Ltac2.Ltac2.
2
3 (* Preterms are not terms *)
4 Fail Notation "[ x ]" := $x.
5
6 Section Foo.
7
8 Notation "[ x ]" := ltac2:(Control.refine (fun _ => Constr.pretype x)).
9
10 Goal [ True ].
11 Proof.
12 constructor.
13 Qed.
14
15 End Foo.
16
17 Section Bar.
18
19 (* Have fun with context capture *)
20 Notation "[ x ]" := ltac2:(
21 let c () := Constr.pretype x in
22 refine constr:(forall n : nat, n = ltac2:(Notations.exact0 true c))
23 ).
24
25 Goal forall n : nat, [ n ].
26 Proof.
27 reflexivity.
28 Qed.
29
30 (* This fails currently, which is arguably a bug *)
31 Fail Goal [ n ].
32
33 End Bar.