# - : < x : int > -> < x : int > -> < x : int > -> < x : int > * < x : int > * < x : int > = # class ['a] c : unit -> object constraint 'a = int method f : int c end and ['a] d : unit -> object constraint 'a = int method f : int c end # Characters 230-271: ....and d () = object inherit ['a] c () end.. Error: Some type variables are unbound in this type: class d : unit -> object method f : 'a -> unit end The method f has type 'a -> unit where 'a is unbound # class virtual c : unit -> object end and ['a] d : unit -> object constraint 'a = < x : int; .. > method f : 'a -> int end # class ['a] c : unit -> object constraint 'a = int end and ['a] d : unit -> object constraint 'a = int #c end # * class ['a] c : 'a -> object ('a) constraint 'a = < f : 'a; .. > method f : 'a end # - : ('a c as 'a) -> 'a = # * Characters 128-176: class x () = object method virtual f : int end.. Error: This class should be virtual. The following methods are undefined : f # Characters 144-152: class virtual c ((x : 'a): < f : int >) = object (_ : 'a) end ^^^^^^^^ Error: This pattern cannot match self: it only matches values of type < f : int > # Characters 32-110: class ['a] c () = object constraint 'a = int method f x = (x : bool c) end.. Error: The abbreviation c is used with parameters bool c which are incompatible with constraints int c # class ['a, 'b] c : unit -> object constraint 'a = int -> 'c constraint 'b = 'a * < x : 'b > * 'c * 'd method f : 'a -> 'b -> unit end # class ['a, 'b] d : unit -> object constraint 'a = int -> 'c constraint 'b = 'a * < x : 'b > * 'c * 'd method f : 'a -> 'b -> unit end # val x : '_weak1 list ref = {contents = []} # Characters 0-50: class ['a] c () = object method f = (x : 'a) end.. Error: The type of this class, class ['a] c : unit -> object constraint 'a = '_weak1 list ref method f : 'a end, contains type variables that cannot be generalized # Characters 21-53: type 'a c = ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Error: In the definition of d, type int c should be 'a c # type 'a c = < f : 'a c; g : 'a d > and 'a d = < f : 'a c > # type 'a c = < f : 'a c > and 'a d = < f : int c > # Characters 22-39: and 'a t = 'a t u;; (* fails since 4.04 *) ^^^^^^^^^^^^^^^^^ Error: The definition of t contains a cycle: 'a t u # Characters 15-32: and 'a t = 'a t u;; ^^^^^^^^^^^^^^^^^ Error: The type abbreviation t is cyclic # type 'a u = 'a # Characters 0-18: type t = t u * t u;; ^^^^^^^^^^^^^^^^^^ Error: The type abbreviation t is cyclic # type t = < x : 'a > as 'a # type 'a u = 'a # - : t -> t u -> bool = # - : t -> t u -> bool = # module M : sig class ['a, 'b] c : int -> 'b -> object constraint 'a = int -> bool val x : float list val y : 'b method f : 'a -> unit method g : 'b end end # module M' : sig class virtual ['a, 'b] c : int -> 'b -> object constraint 'a = int -> bool val x : float list val y : 'b method f : 'a -> unit method g : 'b end end # class ['a, 'b] d : unit -> 'b -> object constraint 'a = int -> bool val x : float list val y : 'b method f : 'a -> unit method g : 'b end # class ['a, 'b] e : unit -> 'b -> object constraint 'a = int -> bool val x : float list val y : 'b method f : 'a -> unit method g : 'b end # - : string = "a" # - : int = 10 # - : float = 7.1 # # - : bool = true # module M : sig class ['a] c : unit -> object method f : 'a -> unit end end # module M' : sig class ['a] c : unit -> object method f : 'a -> unit end end # - : ('a #M.c as 'b) -> 'b = # - : ('a #M'.c as 'b) -> 'b = # class ['a] c : 'a #c -> object end # class ['a] c : 'a #c -> object end # class c : unit -> object method f : int end and d : unit -> object method f : int end # class e : unit -> object method f : int end # - : int = 2 # Characters 30-34: class c () = object val x = - true val y = -. () end;; ^^^^ Error: This expression has type bool but an expression was expected of type int # class c : unit -> object method f : int method g : int method h : int end # class d : unit -> object method h : int method i : int method j : int end # class e : unit -> object method f : int method g : int method h : int method i : int method j : int end # val e : e = # - : int * int * int * int * int = (1, 3, 2, 2, 3) # class c : 'a -> object val a : 'a val x : int val y : int val z : int end # class d : 'a -> object val b : 'a val t : int val u : int val z : int end # Characters 42-45: inherit c 5 ^^^ Warning 13: the following instance variables are overridden by the class c : x The behaviour changed in ocaml 3.10 (previous behaviour was hiding.) Characters 52-53: val y = 3 ^ Warning 13: the instance variable y is overridden. The behaviour changed in ocaml 3.10 (previous behaviour was hiding.) Characters 80-83: inherit d 7 ^^^ Warning 13: the following instance variables are overridden by the class d : t z The behaviour changed in ocaml 3.10 (previous behaviour was hiding.) Characters 90-91: val u = 3 ^ Warning 13: the instance variable u is overridden. The behaviour changed in ocaml 3.10 (previous behaviour was hiding.) class e : unit -> object val a : int val b : int val t : int val u : int val x : int val y : int val z : int method a : int method b : int method t : int method u : int method x : int method y : int method z : int end # val e : e = # - : int * int * int * int * int * int * int = (1, 3, 2, 2, 3, 5, 7) # class c : int -> int -> object val x : int val y : int method x : int method y : int end # class d : int -> int -> object val x : int val y : int method x : int method y : int end # - : int * int = (1, 2) # - : int * int = (1, 2) # class ['a] c : 'a -> object end # - : 'a -> 'a c = # * * * * * * * * * * * * * * * * * * * * * module M : sig class c : unit -> object method xc : int end end # class d : unit -> object val x : int method xc : int method xd : int end # - : int * int = (1, 2) # Characters 1-154: class virtual ['a] matrix (sz, init : int * 'a) = object val m = Array.make_matrix sz sz init method add (mtx : 'a matrix) = (mtx#m.(0).(0) : 'a) end.. Error: The abbreviation 'a matrix expands to type < add : 'a matrix -> 'a > but is used with type < m : 'a array array; .. > # class c : unit -> object method m : c end # - : c = # module M : sig class c : unit -> object method m : c end end # - : M.c = # type uu = A of int | B of (< leq : 'a > as 'a) # class virtual c : unit -> object ('a) method virtual m : 'a end # module S : sig val f : (#c as 'a) -> 'a end # Characters 12-43: ............struct let f (x : #c) = x end...... Error: Signature mismatch: Modules do not match: sig val f : (#c as 'a) -> 'a end is not included in sig val f : #c -> #c end Values do not match: val f : (#c as 'a) -> 'a is not included in val f : #c -> #c # Characters 38-39: module M = struct type t = int class t () = object end end;; ^ Error: Multiple definition of the type name t. Names must be unique in a given structure or signature. # - : < m : (< m : 'a > as 'b) -> 'b as 'a; .. > -> 'b = # Characters 10-39: fun x -> (x : int -> bool :> 'a -> 'a);; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Error: Type int -> bool is not a subtype of int -> int Type bool is not a subtype of int # Characters 9-40: fun x -> (x : int -> bool :> int -> int);; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Error: Type int -> bool is not a subtype of int -> int Type bool is not a subtype of int # - : < > -> < > = # - : < .. > -> < > = # val x : '_weak2 list ref = {contents = []} # module F : functor (X : sig end) -> sig type t = int end # - : < m : int > list ref = {contents = []} # type 'a t # Characters 9-19: fun (x : 'a t as 'a) -> ();; ^^^^^^^^^^ Error: This alias is bound to type 'a t but is used as an instance of type 'a The type variable 'a occurs inside 'a t # Characters 19-20: fun (x : 'a t) -> (x : 'a); ();; ^ Error: This expression has type 'a t but an expression was expected of type 'a The type variable 'a occurs inside 'a t # type 'a t = < x : 'a > # - : ('a t as 'a) -> unit = # Characters 18-26: fun (x : 'a t) -> (x : 'a); ();; ^^^^^^^^ Warning 10: this expression should have type unit. - : ('a t as 'a) t -> unit = # class ['a] c : unit -> object constraint 'a = (< .. > as 'b) -> unit method m : 'b -> unit end # class ['a] c : unit -> object constraint 'a = unit -> (< .. > as 'b) method m : 'a -> 'b end # class c : unit -> object method private m : int method n : int end # class d : unit -> object method private m : int method n : int method o : int end # - : int * int = (1, 1) # class c : unit -> object method m : int end # val r : int ref = {contents = 0} # val id : < .. > -> int = # - : unit = () # - : int = 1 # - : int = 2 # - : int * int * int = (3, 4, 5) # - : int * int * int * int * int = (6, 7, 8, 33, 33) # - : int * int * int * int * int * int * int = (9, 10, 10, 11, 11, 33, 33) # Characters 42-69: class a = let _ = new b in object end ^^^^^^^^^^^^^^^^^^^^^^^^^^^ Error: This kind of recursive class expression is not allowed # Characters 11-38: class a = let _ = new a in object end;; ^^^^^^^^^^^^^^^^^^^^^^^^^^^ Error: This kind of recursive class expression is not allowed #