| 1 |
Set Ltac Backtrace. |
| 2 |
|
| 3 |
(* This used to refer to b instead of z sometimes between 8.4 and 8.5beta3 *) |
| 4 |
Goal True. |
| 5 |
Fail let T := constr:((fun a b : nat => a+b) 1 1) in |
| 6 |
lazymatch T with |
| 7 |
| (fun x z => ?y) 1 1 |
| 8 |
=> pose ((fun x _ => y) 1 1) |
| 9 |
end. |
| 10 |
Abort. |
| 11 |
|
| 12 |
(* This should not raise a warning (see #4317) *) |
| 13 |
Goal True. |
| 14 |
assert (H:= eq_refl ((fun x => x) 1)). |
| 15 |
let HT := type of H in |
| 16 |
lazymatch goal with |
| 17 |
| H1 : HT |- _ => idtac |
| 18 |
end. |
| 19 |
Abort. |
| 20 |
|
| 21 |
Ltac f x y z := |
| 22 |
symmetry in x, y; |
| 23 |
auto with z; |
| 24 |
auto; |
| 25 |
intros; |
| 26 |
clearbody x; |
| 27 |
generalize dependent z. |
| 28 |
|
| 29 |
Print Ltac f. |
| 30 |
|
| 31 |
(* Error messages *) |
| 32 |
|
| 33 |
Ltac g1 x := refine x. |
| 34 |
Tactic Notation "g2" constr(x) := g1 x. |
| 35 |
Tactic Notation "f1" constr(x) := refine x. |
| 36 |
Ltac f2 x := f1 x. |
| 37 |
Goal False. |
| 38 |
Fail g1 I. |
| 39 |
Fail f1 I. |
| 40 |
Fail g2 I. |
| 41 |
Fail f2 I. |
| 42 |
Abort. |
| 43 |
|
| 44 |
Ltac h x := injection x. |
| 45 |
Goal True -> False. |
| 46 |
Fail h I. |
| 47 |
intro H. |
| 48 |
Fail h H. |
| 49 |
Abort. |
| 50 |
|
| 51 |
(* Check printing of the "var" argument "Hx" *) |
| 52 |
Ltac m H := idtac H; exact H. |
| 53 |
Goal True. |
| 54 |
let a:=constr:(let Hx := 0 in ltac:(m Hx)) in idtac. |
| 55 |
Abort. |
| 56 |
|
| 57 |
(* Check consistency of interpretation scopes (#4398) *) |
| 58 |
|
| 59 |
Goal nat*(0*0=0) -> nat*(0*0=0). intro. |
| 60 |
match goal with H: ?x*?y |- _ => idtac x end. |
| 61 |
match goal with |- ?x*?y => idtac x end. |
| 62 |
match goal with H: context [?x*?y] |- _ => idtac x end. |
| 63 |
match goal with |- context [?x*?y] => idtac x end. |
| 64 |
Abort. |
| 65 |
|
| 66 |
(* Check printing of let in Ltac and Tactic Notation *) |
| 67 |
|
| 68 |
Ltac foo := |
| 69 |
let x := intros in |
| 70 |
let y := intros -> in |
| 71 |
let v := constr:(@ nil True) in |
| 72 |
let w := () in |
| 73 |
let z := 1 in |
| 74 |
pose v. |
| 75 |
Print Ltac foo. |
| 76 |
|
| 77 |
(* Ltac renaming was not applied to "fix" and "cofix" *) |
| 78 |
|
| 79 |
Goal forall a, a = 0. |
| 80 |
match goal with |
| 81 |
|- (forall x, x = _) => assert (forall n, (fix x n := match n with O => O | S n => x n end) n = n) |
| 82 |
end. |
| 83 |
intro. |
| 84 |
Show. |
| 85 |
Abort. |