Source

mutated_ocaml / testsuite / tests / typing-objects / Tests.ml.reference

camlspotter 2f3f8b6 





camlspotter 6e3d760 

camlspotter 2f3f8b6 
camlspotter 6e3d760 

camlspotter 2f3f8b6 









camlspotter 6e3d760 

camlspotter 2f3f8b6 
camlspotter 6e3d760 





camlspotter 2f3f8b6 
camlspotter 6e3d760 

camlspotter 2f3f8b6 

camlspotter 6e3d760 

camlspotter 2f3f8b6 















camlspotter 6e3d760 

camlspotter 2f3f8b6 
camlspotter 6e3d760 

camlspotter 2f3f8b6 


camlspotter 6e3d760 



camlspotter 2f3f8b6 





camlspotter 6e3d760 



camlspotter 2f3f8b6 
camlspotter 6e3d760 



camlspotter 2f3f8b6 























































camlspotter 7146b35 

camlspotter 2f3f8b6 





camlspotter 6e3d760 



camlspotter 2f3f8b6 















camlspotter 4eace9a 
camlspotter 6e3d760 


camlspotter 2f3f8b6 

camlspotter 4eace9a 
camlspotter 6e3d760 
camlspotter bb92dae 
camlspotter 2f3f8b6 

camlspotter 4eace9a 
camlspotter 6e3d760 

camlspotter 2f3f8b6 


camlspotter 4eace9a 
camlspotter 6e3d760 
camlspotter bb92dae 
camlspotter 2f3f8b6 


































camlspotter 6e3d760 

camlspotter 2f3f8b6 

camlspotter 6e3d760 

camlspotter 2f3f8b6 







camlspotter 6e3d760 

camlspotter 2f3f8b6 
camlspotter 6e3d760 

camlspotter 2f3f8b6 







camlspotter 6e3d760 



camlspotter 2f3f8b6 

camlspotter 6e3d760 







camlspotter 2f3f8b6 





camlspotter 6e3d760 



camlspotter 7146b35 
camlspotter 6e3d760 



camlspotter 2f3f8b6 
camlspotter 7146b35 
camlspotter 2f3f8b6 

camlspotter 6e3d760 



camlspotter 34e8d4a 
camlspotter 2f3f8b6 









camlspotter 7146b35 





camlspotter 2f3f8b6 

#   - : < x : int > ->
    < x : int > -> < x : int > -> < x : int > * < x : int > * < x : int >
= <fun>
#               class ['a] c : unit -> object constraint 'a = int method f : 'a c end
and ['a] d : unit -> object constraint 'a = int method f : 'a c end
#                 Characters 238-275:
  ........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 = <fun>
# *           Characters 134-176:
  ......x () = object
    method virtual f : int
  end..
Error: This class should be virtual. The following methods are undefined : f
#               Characters 139-147:
  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 38-110:
  ......['a] c () = object
    constraint 'a = int
    method f x = (x : bool c)
  end..
Error: The abbreviation c is used with parameters bool c
       wich 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 : '_a list ref = {contents = []}
#     Characters 6-50:
  ......['a] c () = object
    method f = (x : 'a)
  end..
Error: The type of this class,
       class ['a] c :
         unit -> object constraint 'a = '_b list ref method f : 'a end,
       contains type variables that cannot be generalized
#       Characters 24-52:
  type 'a c = <f : 'a c; g : 'a d>
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
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 >
#   type 'a u = < x : 'a >
and 'a t = 'a t u
#   Characters 18-32:
  and 'a t = 'a t u;;
     ^^^^^^^^^^^^^^
Error: The type abbreviation t is cyclic
# type 'a u = 'a
# Characters 5-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 = <fun>
# - : t -> t u -> bool = <fun>
#                         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 = <fun>
# - : ('a #M'.c as 'b) -> 'b = <fun>
# 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 = <obj>
# - : 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 = <obj>
# - : 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 = <fun>
#     * * * * * * * * * * * * * * * * * * * * *                             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 7-156:
  ......virtual ['a] matrix (sz, init : int * 'a) = object
    val m = Array.create_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 = <obj>
# module M : sig class c : unit -> object method m : c end end
# - : M.c = <obj>
#   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 32-55:
  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 = <fun>
#   Characters 10-39:
  fun x -> (x : int -> bool :> 'a -> 'a);;
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: Type int -> bool is not a subtype of int -> int 
# Characters 9-40:
  fun x -> (x : int -> bool :> int -> int);;
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: Type int -> bool is not a subtype of int -> int 
# - : <  > -> <  > = <fun>
# - : < .. > -> <  > = <fun>
#   val x : '_a 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 = <fun>
# Characters 18-26:
  fun (x : 'a t) -> (x : 'a); ();;
                    ^^^^^^^^
Warning 10: this expression should have type unit.
- : ('a t as 'a) t -> unit = <fun>
#         class ['a] c :
  unit -> object constraint 'a = (< .. > as 'b) -> unit method m : 'a 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
#       - : int = 15
# - : int = 16
# - : int = 17
#         - : int * int * int = (18, 19, 20)
#           - : int * int * int * int * int = (21, 22, 23, 33, 33)
#           - : int * int * int * int * int = (24, 25, 26, 33, 33)
#