aboutsummaryrefslogtreecommitdiff
path: root/test-suite/ltac2/rebind.v
blob: e1c20a2059e0958a23a7201cf3eeaa91b2ad7e30 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
Require Import Ltac2.Ltac2 Ltac2.Notations.

Ltac2 mutable foo () := constructor.

Goal True.
Proof.
foo ().
Qed.

Ltac2 Set foo := fun _ => fail.

Goal True.
Proof.
Fail foo ().
constructor.
Qed.

(** Not the right type *)
Fail Ltac2 Set foo := 0.

Ltac2 bar () := ().

(** Cannot redefine non-mutable tactics *)
Fail Ltac2 Set bar := fun _ => ().

(** Subtype check *)

Ltac2 mutable rec f x := f x.

Fail Ltac2 Set f := fun x => x.

Ltac2 mutable g x := x.

Ltac2 Set g := f.