| 1 |
(* Checking that unrelated terms requiring some scope do not affect |
| 2 |
the interpretation of tactic-in-term. The "Check" was failing with: |
| 3 |
The term "Set" has type "Type" while it is expected to have type |
| 4 |
"nat". *) |
| 5 |
|
| 6 |
Notation bar2 a b := (let __ := ltac:(exact I) in (a + b)%type) (only parsing). |
| 7 |
Check bar2 (Set + Set) Set. |
| 8 |
|
| 9 |
(* Taking into account scopes in notations containing tactic-in-term *) |
| 10 |
|
| 11 |
Declare Scope foo_scope. |
| 12 |
Delimit Scope foo_scope with foo. |
| 13 |
Notation "x ~~" := (x) (at level 0, only parsing) : foo_scope. |
| 14 |
Notation bar x := (x%foo) (only parsing). |
| 15 |
Notation baz x := ltac:(exact x%foo) (only parsing). |
| 16 |
Check bar (O ~~). |
| 17 |
Check baz (O ~~). (* Was failing *) |
| 18 |
|
| 19 |
(* This was reported as bug #8706 *) |
| 20 |
|
| 21 |
Declare Scope my_scope. |
| 22 |
Notation "@ a" := a%nat (at level 100, only parsing) : my_scope. |
| 23 |
Delimit Scope my_scope with my. |
| 24 |
|
| 25 |
Notation "& b" := ltac:(exact (b)%my) (at level 100, only parsing): my_scope. |
| 26 |
Definition test := (& (@4))%my. |
| 27 |
|
| 28 |
(* Check inconsistent scopes *) |
| 29 |
Set Warnings "+inconsistent-scopes". |
| 30 |
Fail Notation bar3 a := (let __ := ltac:(exact a%nat) in a%bool) (only parsing). |