| 1 |
(* Tests about skipping a coercion vs using a notation involving a coercion *) |
| 2 |
|
| 3 |
(* Skipping a coercion vs using a notation for the coercion itself |
| 4 |
(regression #11053 in 8.10 after PR #8890, addressed by PR #11090) *) |
| 5 |
|
| 6 |
Module B. |
| 7 |
|
| 8 |
Section Test. |
| 9 |
Variables (A B : Type) (a : A) (b : B). |
| 10 |
Variable c : A -> B. |
| 11 |
Coercion c : A >-> B. |
| 12 |
Abbreviation COERCION := (c). |
| 13 |
Check b = a. (* printed the same except in 8.10 *) |
| 14 |
End Test. |
| 15 |
|
| 16 |
End B. |
| 17 |
|
| 18 |
Module C. |
| 19 |
|
| 20 |
Record word := { rep: Type }. |
| 21 |
Coercion rep : word >-> Sortclass. |
| 22 |
Axiom myword: word. |
| 23 |
Axiom foo: myword. |
| 24 |
Notation "'(_' 'BitVec' '32)'" := (rep myword). |
| 25 |
Check foo. (* printed with Bitvec from #8890 in 8.10 and 8.11, regression due to #11172 in 8.12 *) |
| 26 |
|
| 27 |
End C. |
| 28 |
|
| 29 |
(* Examples involving coercions to funclass *) |
| 30 |
|
| 31 |
Module D. |
| 32 |
|
| 33 |
Record R := { f :> nat -> nat }. |
| 34 |
Axiom r : R. |
| 35 |
Notation "#[ x ]" := (f x). |
| 36 |
Check #[ r ] 0. (* printed the same from 8.10 (due to #8890), but not 8.11 and 8.12 (due to #11090) *) |
| 37 |
Notation "##[ x ]" := (f x 0). |
| 38 |
Check ##[ r ]. (* printed the same from 8.10 *) |
| 39 |
Check #[ r ] 0. (* printed ##[ r ] from 8.10 *) |
| 40 |
|
| 41 |
End D. |
| 42 |
|
| 43 |
(* Same examples with a parameter *) |
| 44 |
|
| 45 |
Module E. |
| 46 |
|
| 47 |
Record R A := { f :> A -> A }. |
| 48 |
Axiom r : R nat. |
| 49 |
Notation "#[ x ]" := (f nat x). |
| 50 |
Check #[ r ] 0. (* printed the same from 8.10 (due to #8890), but not 8.11 and 8.12 (due to #11090) *) |
| 51 |
Notation "##[ x ]" := (f nat x 0). |
| 52 |
Check ##[ r ]. (* printed the same from 8.10 *) |
| 53 |
Check #[ r ] 0. (* printed ##[ r ] from 8.10 *) |
| 54 |
|
| 55 |
End E. |