| 1 |
Require Import Ltac2.Ltac2. |
| 2 |
|
| 3 |
Ltac2 foo1 x := (). |
| 4 |
|
| 5 |
Ltac2 foo2 x := fun y => (). |
| 6 |
|
| 7 |
(* we don't warn on _ prefixed variable *) |
| 8 |
Ltac2 foo3 _x := (). |
| 9 |
|
| 10 |
Ltac2 Notation "foo4" x(constr) := (). |
| 11 |
|
| 12 |
(* questionable behaviour: unused variable in untyped notation warns at notation use time *) |
| 13 |
Unset Ltac2 Typed Notations. |
| 14 |
Ltac2 Notation "foo5" x(constr) := (). |
| 15 |
Set Ltac2 Typed Notations. |
| 16 |
Ltac2 foo6 () := foo5 1. |
| 17 |
|
| 18 |
Ltac2 foo7 x := match x with y => () end. |
| 19 |
|
| 20 |
Ltac2 foo8 x := match x with Some x => 1 | None => 2 end. |
| 21 |
|
| 22 |
Ltac2 foo9 x := match x with (a,b) => a end. |
| 23 |
|
| 24 |
Ltac2 foo10 := let x := () in (). |
| 25 |
|
| 26 |
Ltac2 foo11 () := let (x,y) := (1,2) in (). |
| 27 |
|
| 28 |
Ltac2 foo12 () := let (x,y) := (1,2) in x. |
| 29 |
|
| 30 |
Ltac2 foo13 () := let rec x () := 1 with y () := 2 in x. |
| 31 |
|
| 32 |
Ltac2 foo14 () := let rec x () := y () with y () := 2 in x. |
| 33 |
|
| 34 |
(* missing warning for unused letrec (bug?) *) |
| 35 |
Ltac2 foo15 () := let rec x () := y () with y () := x () in (). |
| 36 |
|
| 37 |
Ltac2 mutable bar () := (). |
| 38 |
|
| 39 |
(* missing warning for unused "Set as" (bug?) *) |
| 40 |
Ltac2 Set bar as bar0 := fun () => (). |
| 41 |
|
| 42 |
Ltac2 foo16 () := ltac1:(ltac2:(x |- ())). |
| 43 |
|
| 44 |
(* no warning for y even though it's bound in the ltac2 context |
| 45 |
(ltac2 can't tell that the notation isn't eg "ltac2:(...) + y") *) |
| 46 |
Abbreviation foo17 x y := ltac2:(exact $preterm:x) (only parsing). |
| 47 |
|
| 48 |
(* the usage of the second "a" binder should not prevent warning for the first "a" *) |
| 49 |
Ltac2 foo18 a a := a. |