summaryrefslogtreecommitdiff
path: root/testsuite/tests/typing-objects/abstract_rows.ml
blob: 3b9269253011fb0e6ce4c8bcadebfa9de093f34e (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
(* TEST
 expect;
*)
type u = <x:int>
type t = private <u; ..>

let f (x:t) (y:u) = x = y;;
[%%expect{|
type u = < x : int >
type t = private < x : int; .. >
Line 4, characters 24-25:
4 | let f (x:t) (y:u) = x = y;;
                            ^
Error: This expression has type u but an expression was expected of type t
       The second object type has an abstract row, it cannot be closed
|}]


let g (x:u) (y:t) = x = y;;
[%%expect{|
Line 1, characters 24-25:
1 | let g (x:u) (y:t) = x = y;;
                            ^
Error: This expression has type t but an expression was expected of type u
       The first object type has an abstract row, it cannot be closed
|}]