blob: 706e37310c5051eee68b9e60436608af6d2007e4 (
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
|
(* TEST
* expect
*)
type 'a t
type a
let f : < .. > t -> unit = fun _ -> ();;
let g : [< `b] t -> unit = fun _ -> ();;
let h : [> `b] t -> unit = fun _ -> ();;
[%%expect{|
type 'a t
type a
val f : < .. > t -> unit = <fun>
val g : [< `b ] t -> unit = <fun>
val h : [> `b ] t -> unit = <fun>
|}];;
let _ = fun (x : a t) -> f x;;
[%%expect{|
Line _, characters 27-28:
let _ = fun (x : a t) -> f x;;
^
Error: This expression has type a t but an expression was expected of type
(< .. > as 'a) t
Type a is not compatible with type < .. > as 'a
|}];;
let _ = fun (x : a t) -> g x;;
[%%expect{|
Line _, characters 27-28:
let _ = fun (x : a t) -> g x;;
^
Error: This expression has type a t but an expression was expected of type
([< `b ] as 'a) t
Type a is not compatible with type [< `b ] as 'a
|}];;
let _ = fun (x : a t) -> h x;;
[%%expect{|
Line _, characters 27-28:
let _ = fun (x : a t) -> h x;;
^
Error: This expression has type a t but an expression was expected of type
([> `b ] as 'a) t
Type a is not compatible with type [> `b ] as 'a
|}];;
|