blob: 0524bed98c0087bb41c033f76a4720b080e8f9b8 (
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
(* Tests about skipping a coercion vs using a notation involving a coercion *)
Require Import String.
(* Skipping a coercion vs using a notation for the application of the
coercion (from Robbert Krebbers, see PR #8890) *)
Module A.
Inductive expr :=
| Var : string -> expr
| Lam : string -> expr -> expr
| App : expr -> expr -> expr.
Notation Let x e1 e2 := (App (Lam x e2) e1).
Parameter e1 e2 : expr.
Check (Let "x" e1 e2). (* always printed the same *)
Coercion App : expr >-> Funclass.
Check (Let "x" e1 e2). (* printed the same from #8890, in 8.10 *)
Axiom free_vars :> expr -> list string.
Check (Let "x" e1 e2) : list string. (* printed the same from #11172, in 8.12 *)
End A.
(* Skipping a coercion vs using a notation for the coercion itself
(regression #11053 in 8.10 after PR #8890, addressed by PR #11090) *)
Module B.
Section Test.
Variables (A B : Type) (a : A) (b : B).
Variable c : A -> B.
Coercion c : A >-> B.
Notation COERCION := (c).
Check b = a. (* printed the same except in 8.10 *)
End Test.
End B.
Module C.
Record word := { rep: Type }.
Coercion rep : word >-> Sortclass.
Axiom myword: word.
Axiom foo: myword.
Notation "'(_' 'BitVec' '32)'" := (rep myword).
Check foo. (* printed with Bitvec from #8890 in 8.10 and 8.11, regression due to #11172 in 8.12 *)
End C.
(* Examples involving coercions to funclass *)
Module D.
Record R := { f :> nat -> nat }.
Axiom r : R.
Notation "#[ x ]" := (f x).
Check #[ r ] 0. (* printed the same from 8.10 (due to #8890), but not 8.11 and 8.12 (due to #11090) *)
Notation "##[ x ]" := (f x 0).
Check ##[ r ]. (* printed the same from 8.10 *)
Check #[ r ] 0. (* printed ##[ r ] from 8.10 *)
End D.
(* Same examples with a parameter *)
Module E.
Record R A := { f :> A -> A }.
Axiom r : R nat.
Notation "#[ x ]" := (f nat x).
Check #[ r ] 0. (* printed the same from 8.10 (due to #8890), but not 8.11 and 8.12 (due to #11090) *)
Notation "##[ x ]" := (f nat x 0).
Check ##[ r ]. (* printed the same from 8.10 *)
Check #[ r ] 0. (* printed ##[ r ] from 8.10 *)
End E.
|