Debian Codegraph @

test-suite/bugs/bug_9014.v

raw
1 (* A type, not a class *)
2 Variant T := mkT.
3
4 (* :> declares a coercion *)
5 Record R := { t_of_r :> T }.
6 Check forall r : R, r = r :> T.
7
8 (* A class *)
9 Class A := { p : Prop }.
10 (* A sub-class *)
11 Class B := { a_of_b :: A ; t_of_b :: T }.
12 (* The sub-instance is automatically inferred due to :: for a_of_b *)
13 Check forall b : B, p.
14 (* No coercion is introduced by :> in t_of_b *)
15 Fail Check forall b : B, b = b :> T.
16
17 (* Using :: when the RHS is not a class produces a “not-a-class” warning. *)
18 Set Warnings "+not-a-class".
19 Fail Class B' := { a_of_b' :: A ; t_of_b' :: T }.