summaryrefslogtreecommitdiff
path: root/testsuite/tests/typing-misc/exotic_unifications.ml
blob: 2e3e69692fce94a89d6f899d1f23d5471a717a1f (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
(* TEST
   * expect
*)

class virtual t = object method virtual x: float end

class x = object(self: <x:int; ..>)
        inherit t
end
[%%expect {|
class virtual t : object method virtual x : float end
Line 4, characters 8-17:
4 |         inherit t
            ^^^^^^^^^
Error: The method x has type int but is expected to have type float
       Type int is not compatible with type float
|}]

let x =
  let module M = struct module type t = sig end end in
  (module struct end: M.t)
[%%expect {|
Line 3, characters 2-26:
3 |   (module struct end: M.t)
      ^^^^^^^^^^^^^^^^^^^^^^^^
Error: This expression has type (module M.t)
       but an expression was expected of type 'a
       The module type M.t would escape its scope
|}]