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