| 1 |
(* Check discharge of arguments scopes + other checks *) |
| 2 |
|
| 3 |
(* This is bug #4865 *) |
| 4 |
|
| 5 |
Notation "<T>" := true : bool_scope. |
| 6 |
Section A. |
| 7 |
Check negb <T>. |
| 8 |
Global Arguments negb : clear scopes. |
| 9 |
Fail Check negb <T>. |
| 10 |
End A. |
| 11 |
|
| 12 |
(* Check that no scope is re-computed *) |
| 13 |
Fail Check negb <T>. |
| 14 |
|
| 15 |
(* Another test about arguments scopes in sections *) |
| 16 |
|
| 17 |
Notation "0" := true. |
| 18 |
Section B. |
| 19 |
Variable x : nat. |
| 20 |
Let T := nat -> nat. |
| 21 |
Definition f y : T := fun z => x + y + z. |
| 22 |
Fail Check f 1 0. (* 0 in nat, 0 in bool *) |
| 23 |
Fail Check f 0 0. (* 0 in nat, 0 in bool *) |
| 24 |
Check f 0 1. (* 0 and 1 in nat *) |
| 25 |
Global Arguments f _%_nat_scope _%_nat_scope. |
| 26 |
Check f 0 0. (* both 0 in nat *) |
| 27 |
End B. |
| 28 |
|
| 29 |
(* Check that only the scope for the extra product on x is re-computed *) |
| 30 |
Check f 0 0 0. (* All 0 in nat *) |
| 31 |
|
| 32 |
Section C. |
| 33 |
Variable x : nat. |
| 34 |
Let T := nat -> nat. |
| 35 |
Definition g y : T := fun z => x + y + z. |
| 36 |
Global Arguments g : clear scopes. |
| 37 |
Check g 1. (* 1 in nat *) |
| 38 |
End C. |
| 39 |
|
| 40 |
(* Check that only the scope for the extra product on x is re-computed *) |
| 41 |
Check g 0. (* 0 in nat *) |
| 42 |
Fail Check g 0 1 0. (* 2nd 0 in bool *) |
| 43 |
Fail Check g 0 0 1. (* 2nd 0 in bool *) |
| 44 |
|
| 45 |
(* Another test on arguments scopes: checking scope for expanding arities *) |
| 46 |
(* Not sure this is very useful, but why not *) |
| 47 |
|
| 48 |
Fixpoint arr n := match n with 0%nat => nat | S n => nat -> arr n end. |
| 49 |
Fixpoint lam n : arr n := match n with 0%nat => 0%nat | S n => fun x => lam n end. |
| 50 |
Notation "0" := true. |
| 51 |
Arguments lam _%_nat_scope _%_nat_scope : extra scopes. |
| 52 |
Check (lam 1 0). |