summaryrefslogtreecommitdiff
path: root/testsuite/tests/typing-objects/self_cannot_be_closed.ml
blob: ccd0f918324c798d34f4bf2de7deb1bd116d1d0d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
(* TEST
 expect;
*)
let is_empty (x : < >) = ();;
[%%expect {|
val is_empty : <  > -> unit = <fun>
|}]

class c = object (self) method private foo = is_empty self end;;
[%%expect {|
Line 1, characters 54-58:
1 | class c = object (self) method private foo = is_empty self end;;
                                                          ^^^^
Error: This expression has type < .. > but an expression was expected of type
         <  >
       Self type cannot be unified with a closed object type
|}]