summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSébastien Hinderer <Sebastien.Hinderer@inria.fr>2017-12-19 17:11:45 +0100
committerSébastien Hinderer <Sebastien.Hinderer@inria.fr>2018-01-17 12:04:41 +0100
commit3568faff6333b8154865f29b139bd8327fee734d (patch)
tree3c03346b5164578735d0a1eb74d41f05afc7de46
parent16c514ed7eafe2f1921a023ef4875e1267513d1b (diff)
downloadocaml-3568faff6333b8154865f29b139bd8327fee734d.tar.gz
Migrate typing-objects tests to ocamltest
-rw-r--r--testsuite/tests/typing-objects/Exemples.compilers.reference (renamed from testsuite/tests/typing-objects/Exemples.ml.reference)179
-rw-r--r--testsuite/tests/typing-objects/Exemples.ml3
-rw-r--r--testsuite/tests/typing-objects/Makefile18
-rw-r--r--testsuite/tests/typing-objects/Tests.compilers.reference (renamed from testsuite/tests/typing-objects/Tests.ml.reference)207
-rw-r--r--testsuite/tests/typing-objects/Tests.ml4
-rw-r--r--testsuite/tests/typing-objects/ocamltests9
-rw-r--r--testsuite/tests/typing-objects/open_in_classes.compilers.reference4
-rw-r--r--[-rwxr-xr-x]testsuite/tests/typing-objects/open_in_classes.ml4
-rw-r--r--testsuite/tests/typing-objects/open_in_classes.ml.reference5
-rw-r--r--testsuite/tests/typing-objects/pr5545.compilers.reference5
-rw-r--r--testsuite/tests/typing-objects/pr5545.ml4
-rw-r--r--testsuite/tests/typing-objects/pr5545.ml.reference6
-rw-r--r--testsuite/tests/typing-objects/pr5619_bad.compilers.reference (renamed from testsuite/tests/typing-objects/pr5619_bad.ml.reference)9
-rw-r--r--testsuite/tests/typing-objects/pr5619_bad.ml4
-rw-r--r--testsuite/tests/typing-objects/pr5858.compilers.reference (renamed from testsuite/tests/typing-objects/pr5858.ml.reference)7
-rw-r--r--testsuite/tests/typing-objects/pr5858.ml4
-rw-r--r--testsuite/tests/typing-objects/pr6123_bad.compilers.reference (renamed from testsuite/tests/typing-objects/pr6123_bad.ml.reference)5
-rw-r--r--testsuite/tests/typing-objects/pr6123_bad.ml4
-rw-r--r--testsuite/tests/typing-objects/pr6383.compilers.reference (renamed from testsuite/tests/typing-objects/pr6383.ml.reference)5
-rw-r--r--testsuite/tests/typing-objects/pr6383.ml4
-rw-r--r--testsuite/tests/typing-objects/pr6907_bad.compilers.reference (renamed from testsuite/tests/typing-objects/pr6907_bad.ml.reference)7
-rw-r--r--testsuite/tests/typing-objects/pr6907_bad.ml4
22 files changed, 259 insertions, 242 deletions
diff --git a/testsuite/tests/typing-objects/Exemples.ml.reference b/testsuite/tests/typing-objects/Exemples.compilers.reference
index cfd13603e5..5dc7a51d53 100644
--- a/testsuite/tests/typing-objects/Exemples.ml.reference
+++ b/testsuite/tests/typing-objects/Exemples.compilers.reference
@@ -1,14 +1,13 @@
-
-# class point :
+class point :
int ->
object val mutable x : int method get_x : int method move : int -> unit end
-# val p : point = <obj>
-# - : int = 7
-# - : unit = ()
-# - : int = 10
-# val q : point = <obj>
-# - : int * int = (10, 17)
-# class color_point :
+val p : point = <obj>
+- : int = 7
+- : unit = ()
+- : int = 10
+val q : point = <obj>
+- : int * int = (10, 17)
+class color_point :
int ->
string ->
object
@@ -18,13 +17,13 @@
method get_x : int
method move : int -> unit
end
-# val p' : color_point = <obj>
-# - : int * string = (5, "red")
-# val l : point list = [<obj>; <obj>]
-# val get_x : < get_x : 'a; .. > -> 'a = <fun>
-# val set_x : < set_x : 'a; .. > -> 'a = <fun>
-# - : int list = [10; 5]
-# Characters 1-96:
+val p' : color_point = <obj>
+- : int * string = (5, "red")
+val l : point list = [<obj>; <obj>]
+val get_x : < get_x : 'a; .. > -> 'a = <fun>
+val set_x : < set_x : 'a; .. > -> 'a = <fun>
+- : int list = [10; 5]
+Characters 1-96:
class ref x_init = object
val mutable x = x_init
method get = x
@@ -39,13 +38,13 @@ Error: Some type variables are unbound in this type:
method set : 'a -> unit
end
The method get has type 'a where 'a is unbound
-# class ref :
+class ref :
int ->
object val mutable x : int method get : int method set : int -> unit end
-# class ['a] ref :
+class ['a] ref :
'a -> object val mutable x : 'a method get : 'a method set : 'a -> unit end
-# - : int = 2
-# class ['a] circle :
+- : int = 2
+class ['a] circle :
'a ->
object
constraint 'a = < move : int -> unit; .. >
@@ -54,7 +53,7 @@ Error: Some type variables are unbound in this type:
method move : int -> unit
method set_center : 'a -> unit
end
-# class ['a] circle :
+class ['a] circle :
'a ->
object
constraint 'a = #point
@@ -63,9 +62,9 @@ Error: Some type variables are unbound in this type:
method move : int -> unit
method set_center : 'a -> unit
end
-# val c : point circle = <obj>
+val c : point circle = <obj>
val c' : color_point circle = <obj>
-# class ['a] color_circle :
+class ['a] color_circle :
'a ->
object
constraint 'a = #color_point
@@ -75,15 +74,15 @@ val c' : color_point circle = <obj>
method move : int -> unit
method set_center : 'a -> unit
end
-# Characters 28-29:
+Characters 28-29:
let c'' = new color_circle p;;
^
Error: This expression has type point but an expression was expected of type
#color_point
The first object type has no method color
-# val c'' : color_point color_circle = <obj>
-# - : color_point circle = <obj>
-# Characters 0-21:
+val c'' : color_point color_circle = <obj>
+- : color_point circle = <obj>
+Characters 0-21:
(c'' :> point circle);; (* Fail *)
^^^^^^^^^^^^^^^^^^^^^
Error: Type
@@ -94,7 +93,7 @@ Error: Type
point circle =
< center : point; move : int -> unit; set_center : point -> unit >
Type point is not a subtype of color_point
-# Characters 9-55:
+Characters 9-55:
fun x -> (x : color_point color_circle :> point circle);;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: Type
@@ -105,7 +104,7 @@ Error: Type
point circle =
< center : point; move : int -> unit; set_center : point -> unit >
Type point is not a subtype of color_point
-# class printable_point :
+class printable_point :
int ->
object
val mutable x : int
@@ -113,9 +112,9 @@ Error: Type
method move : int -> unit
method print : unit
end
-# val p : printable_point = <obj>
-# 7- : unit = ()
-# Characters 85-102:
+val p : printable_point = <obj>
+7- : unit = ()
+Characters 85-102:
inherit printable_point y as super
^^^^^^^^^^^^^^^^^
Warning 13: the following instance variables are overridden by the class printable_point :
@@ -132,17 +131,17 @@ class printable_color_point :
method move : int -> unit
method print : unit
end
-# val p' : printable_color_point = <obj>
-# (7, red)- : unit = ()
-# class functional_point :
+val p' : printable_color_point = <obj>
+(7, red)- : unit = ()
+class functional_point :
int ->
object ('a) val x : int method get_x : int method move : int -> 'a end
-# val p : functional_point = <obj>
-# - : int = 7
-# - : int = 10
-# - : int = 7
-# - : #functional_point -> functional_point = <fun>
-# class virtual ['a] lst :
+val p : functional_point = <obj>
+- : int = 7
+- : int = 10
+- : int = 7
+- : #functional_point -> functional_point = <fun>
+class virtual ['a] lst :
unit ->
object
method virtual hd : 'a
@@ -175,18 +174,18 @@ and ['a] cons :
method print : ('a -> unit) -> unit
method tl : 'a lst
end
-# val l1 : int lst = <obj>
-# (3::10::[])- : unit = ()
-# val l2 : int lst = <obj>
-# (4::11::[])- : unit = ()
-# val map_list : ('a -> 'b) -> 'a lst -> 'b lst = <fun>
-# val p1 : printable_color_point lst = <obj>
-# ((3, red)::(10, red)::[])- : unit = ()
-# class virtual comparable :
+val l1 : int lst = <obj>
+(3::10::[])- : unit = ()
+val l2 : int lst = <obj>
+(4::11::[])- : unit = ()
+val map_list : ('a -> 'b) -> 'a lst -> 'b lst = <fun>
+val p1 : printable_color_point lst = <obj>
+((3, red)::(10, red)::[])- : unit = ()
+class virtual comparable :
unit -> object ('a) method virtual cmp : 'a -> int end
-# class int_comparable :
+class int_comparable :
int -> object ('a) val x : int method cmp : 'a -> int method x : int end
-# class int_comparable2 :
+class int_comparable2 :
int ->
object ('a)
val x : int
@@ -195,7 +194,7 @@ and ['a] cons :
method set_x : int -> unit
method x : int
end
-# class ['a] sorted_list :
+class ['a] sorted_list :
unit ->
object
constraint 'a = #comparable
@@ -203,11 +202,11 @@ and ['a] cons :
method add : 'a -> unit
method hd : 'a
end
-# val l : _#comparable sorted_list = <obj>
-# val c : int_comparable = <obj>
-# - : unit = ()
-# val c2 : int_comparable2 = <obj>
-# Characters 6-28:
+val l : _#comparable sorted_list = <obj>
+val c : int_comparable = <obj>
+- : unit = ()
+val c2 : int_comparable2 = <obj>
+Characters 6-28:
l#add (c2 :> int_comparable);; (* Fail : 'a comp2 is not a subtype *)
^^^^^^^^^^^^^^^^^^^^^^
Error: Type
@@ -219,8 +218,8 @@ Error: Type
is not a subtype of
int_comparable2 =
< cmp : int_comparable2 -> int; set_x : int -> unit; x : int >
-# - : unit = ()
-# class int_comparable3 :
+- : unit = ()
+class int_comparable3 :
int ->
object
val mutable x : int
@@ -228,9 +227,9 @@ Error: Type
method setx : int -> unit
method x : int
end
-# val c3 : int_comparable3 = <obj>
-# - : unit = ()
-# Characters 25-27:
+val c3 : int_comparable3 = <obj>
+- : unit = ()
+Characters 25-27:
(new sorted_list ())#add c3;; (* Error; strange message with -principal *)
^^
Error: This expression has type
@@ -243,26 +242,26 @@ Error: This expression has type
int_comparable3 =
< cmp : int_comparable -> int; setx : int -> unit; x : int >
The first object type has no method setx
-# val sort : (#comparable as 'a) list -> 'a list = <fun>
-# Characters 13-66:
+val sort : (#comparable as 'a) list -> 'a list = <fun>
+Characters 13-66:
List.map (fun c -> print_int c#x; print_string " ") l;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Warning 10: this expression should have type unit.
val pr : < x : int; .. > list -> unit = <fun>
-# val l : int_comparable list = [<obj>; <obj>; <obj>]
-# 5 2 4
+val l : int_comparable list = [<obj>; <obj>; <obj>]
+5 2 4
- : unit = ()
-# 2 4 5
+2 4 5
- : unit = ()
-# val l : int_comparable2 list = [<obj>; <obj>]
-# 2 0
+val l : int_comparable2 list = [<obj>; <obj>]
+2 0
- : unit = ()
-# 0 2
+0 2
- : unit = ()
-# val min : (#comparable as 'a) -> 'a -> 'a = <fun>
-# - : int = 7
-# - : int = 3
-# class ['a] link :
+val min : (#comparable as 'a) -> 'a -> 'a = <fun>
+- : int = 7
+- : int = 3
+class ['a] link :
'a ->
object ('b)
val mutable next : 'b option
@@ -273,7 +272,7 @@ val pr : < x : int; .. > list -> unit = <fun>
method set_x : 'a -> unit
method x : 'a
end
-# class ['a] double_link :
+class ['a] double_link :
'a ->
object ('b)
val mutable next : 'b option
@@ -287,8 +286,8 @@ val pr : < x : int; .. > list -> unit = <fun>
method set_x : 'a -> unit
method x : 'a
end
-# val fold_right : ('a -> 'b -> 'b) -> 'a #link option -> 'b -> 'b = <fun>
-# class calculator :
+val fold_right : ('a -> 'b -> 'b) -> 'a #link option -> 'b -> 'b = <fun>
+class calculator :
unit ->
object ('a)
val mutable acc : float
@@ -301,10 +300,10 @@ val pr : < x : int; .. > list -> unit = <fun>
method equals : float
method sub : 'a
end
-# - : float = 5.
-# - : float = 1.5
-# - : float = 15.
-# class calculator :
+- : float = 5.
+- : float = 1.5
+- : float = 15.
+class calculator :
unit ->
object ('a)
val mutable acc : float
@@ -317,10 +316,10 @@ val pr : < x : int; .. > list -> unit = <fun>
method equals : float
method sub : 'a
end
-# - : float = 5.
-# - : float = 1.5
-# - : float = 15.
-# class calculator :
+- : float = 5.
+- : float = 1.5
+- : float = 15.
+class calculator :
float ->
float ->
object
@@ -353,8 +352,8 @@ and calculator_sub :
method equals : float
method sub : calculator
end
-# val calculator : calculator = <obj>
-# - : float = 5.
-# - : float = 1.5
-# - : float = 15.
-#
+val calculator : calculator = <obj>
+- : float = 5.
+- : float = 1.5
+- : float = 15.
+
diff --git a/testsuite/tests/typing-objects/Exemples.ml b/testsuite/tests/typing-objects/Exemples.ml
index f0ab4d533b..569aa52c78 100644
--- a/testsuite/tests/typing-objects/Exemples.ml
+++ b/testsuite/tests/typing-objects/Exemples.ml
@@ -1,3 +1,6 @@
+(* TEST
+ * toplevel
+*)
class point x_init = object
val mutable x = x_init
diff --git a/testsuite/tests/typing-objects/Makefile b/testsuite/tests/typing-objects/Makefile
deleted file mode 100644
index 7fc00661cb..0000000000
--- a/testsuite/tests/typing-objects/Makefile
+++ /dev/null
@@ -1,18 +0,0 @@
-#**************************************************************************
-#* *
-#* OCaml *
-#* *
-#* Xavier Clerc, SED, INRIA Rocquencourt *
-#* *
-#* Copyright 2010 Institut National de Recherche en Informatique et *
-#* en Automatique. *
-#* *
-#* All rights reserved. This file is distributed under the terms of *
-#* the GNU Lesser General Public License version 2.1, with the *
-#* special exception on linking described in the file LICENSE. *
-#* *
-#**************************************************************************
-
-BASEDIR=../..
-include $(BASEDIR)/makefiles/Makefile.toplevel
-include $(BASEDIR)/makefiles/Makefile.common
diff --git a/testsuite/tests/typing-objects/Tests.ml.reference b/testsuite/tests/typing-objects/Tests.compilers.reference
index ba027f1de8..3c287ec0b2 100644
--- a/testsuite/tests/typing-objects/Tests.ml.reference
+++ b/testsuite/tests/typing-objects/Tests.compilers.reference
@@ -1,57 +1,56 @@
-
-# - : < x : int > ->
+- : < x : int > ->
< x : int > -> < x : int > -> < x : int > * < x : int > * < x : int >
= <fun>
-# class ['a] c : unit -> object constraint 'a = int method f : int c end
+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:
+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
+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
+class ['a] c : unit -> object constraint 'a = int end
and ['a] d : unit -> object constraint 'a = int #c end
-# * class ['a] c :
+class ['a] c :
'a -> object ('a) constraint 'a = < f : 'a; .. > method f : 'a end
-# - : ('a c as 'a) -> 'a = <fun>
-# * Characters 128-176:
+- : ('a c as 'a) -> 'a = <fun>
+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:
+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:
+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 :
+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 :
+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:
+val x : '_weak1 list ref = {contents = []}
+Characters 0-50:
class ['a] c () = object
method f = (x : 'a)
end..
@@ -59,33 +58,33 @@ 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:
+Characters 21-53:
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 >
+type 'a c = < f : 'a c; g : 'a d >
and 'a d = < f : 'a c >
-# type 'a c = < f : 'a c >
+type 'a c = < f : 'a c >
and 'a d = < f : int c >
-# Characters 22-39:
+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:
+Characters 15-32:
and 'a t = 'a t u;;
^^^^^^^^^^^^^^^^^
Error: The type abbreviation t is cyclic
-# type 'a u = 'a
-# Characters 0-18:
+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 = <fun>
-# - : t -> t u -> bool = <fun>
-# module M :
+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 ->
@@ -98,7 +97,7 @@ Error: The type abbreviation t is cyclic
method g : 'b
end
end
-# module M' :
+module M' :
sig
class virtual ['a, 'b] c :
int ->
@@ -111,7 +110,7 @@ Error: The type abbreviation t is cyclic
method g : 'b
end
end
-# class ['a, 'b] d :
+class ['a, 'b] d :
unit ->
'b ->
object
@@ -121,7 +120,7 @@ Error: The type abbreviation t is cyclic
method f : 'a -> unit
method g : 'b
end
-# class ['a, 'b] e :
+class ['a, 'b] e :
unit ->
'b ->
object
@@ -131,28 +130,28 @@ Error: The type abbreviation t is cyclic
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
+- : 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 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 :
+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
@@ -161,11 +160,11 @@ Error: This expression has type bool but an expression was expected of type
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:
+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 :
@@ -205,36 +204,36 @@ class e :
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 :
+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 :
+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 1-154:
+- : 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 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 = <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:
+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......
@@ -247,71 +246,71 @@ Error: Signature mismatch:
val f : (#c as 'a) -> 'a
is not included in
val f : #c -> #c
-# Characters 38-39:
+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 = <fun>
-# Characters 10-39:
+- : < 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
Type bool is not a subtype of int
-# Characters 9-40:
+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
-# - : < > -> < > = <fun>
-# - : < .. > -> < > = <fun>
-# 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>
+- : < .. > -> < > = <fun>
+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:
+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:
+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 :
+class ['a] c :
unit ->
object constraint 'a = (< .. > as 'b) -> unit method m : 'b -> unit end
-# class ['a] c :
+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 :
+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 = <fun>
-# - : 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:
+- : int * int = (1, 1)
+class c : unit -> object method m : int end
+val r : int ref = {contents = 0}
+val id : < .. > -> int = <fun>
+- : 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:
+Characters 11-38:
class a = let _ = new a in object end;;
^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: This kind of recursive class expression is not allowed
-#
+
diff --git a/testsuite/tests/typing-objects/Tests.ml b/testsuite/tests/typing-objects/Tests.ml
index b646ade3e7..4014d33611 100644
--- a/testsuite/tests/typing-objects/Tests.ml
+++ b/testsuite/tests/typing-objects/Tests.ml
@@ -1,3 +1,7 @@
+(* TEST
+ * toplevel
+*)
+
(* Subtyping is "syntactic" *)
fun (x : < x : int >) y z -> (y :> 'a), (x :> 'a), (z :> 'a);;
(* - : (< x : int > as 'a) -> 'a -> 'a * 'a = <fun> *)
diff --git a/testsuite/tests/typing-objects/ocamltests b/testsuite/tests/typing-objects/ocamltests
new file mode 100644
index 0000000000..89f578b082
--- /dev/null
+++ b/testsuite/tests/typing-objects/ocamltests
@@ -0,0 +1,9 @@
+Exemples.ml
+open_in_classes.ml
+pr5545.ml
+pr5619_bad.ml
+pr5858.ml
+pr6123_bad.ml
+pr6383.ml
+pr6907_bad.ml
+Tests.ml
diff --git a/testsuite/tests/typing-objects/open_in_classes.compilers.reference b/testsuite/tests/typing-objects/open_in_classes.compilers.reference
new file mode 100644
index 0000000000..111c3f6d7e
--- /dev/null
+++ b/testsuite/tests/typing-objects/open_in_classes.compilers.reference
@@ -0,0 +1,4 @@
+module M : sig type t = int val x : int end
+class c : object method f : M.t end
+class type ct = object method f : M.t end
+
diff --git a/testsuite/tests/typing-objects/open_in_classes.ml b/testsuite/tests/typing-objects/open_in_classes.ml
index 24c0b34dfe..b5cf79f619 100755..100644
--- a/testsuite/tests/typing-objects/open_in_classes.ml
+++ b/testsuite/tests/typing-objects/open_in_classes.ml
@@ -1,3 +1,7 @@
+(* TEST
+ * toplevel
+*)
+
module M = struct
type t = int
let x = 42
diff --git a/testsuite/tests/typing-objects/open_in_classes.ml.reference b/testsuite/tests/typing-objects/open_in_classes.ml.reference
deleted file mode 100644
index eaafa30f16..0000000000
--- a/testsuite/tests/typing-objects/open_in_classes.ml.reference
+++ /dev/null
@@ -1,5 +0,0 @@
-
-# module M : sig type t = int val x : int end
-# class c : object method f : M.t end
-# class type ct = object method f : M.t end
-#
diff --git a/testsuite/tests/typing-objects/pr5545.compilers.reference b/testsuite/tests/typing-objects/pr5545.compilers.reference
new file mode 100644
index 0000000000..29cbecd087
--- /dev/null
+++ b/testsuite/tests/typing-objects/pr5545.compilers.reference
@@ -0,0 +1,5 @@
+type foo = int
+class o : object method x : foo method y : int end
+class o : object method x : foo method y : int end
+class o : object method x : int method y : foo end
+
diff --git a/testsuite/tests/typing-objects/pr5545.ml b/testsuite/tests/typing-objects/pr5545.ml
index 1273e6f0b1..e1c7e6dee3 100644
--- a/testsuite/tests/typing-objects/pr5545.ml
+++ b/testsuite/tests/typing-objects/pr5545.ml
@@ -1,3 +1,7 @@
+(* TEST
+ * toplevel
+*)
+
type foo = int;;
class o =
diff --git a/testsuite/tests/typing-objects/pr5545.ml.reference b/testsuite/tests/typing-objects/pr5545.ml.reference
deleted file mode 100644
index 4f7fda9661..0000000000
--- a/testsuite/tests/typing-objects/pr5545.ml.reference
+++ /dev/null
@@ -1,6 +0,0 @@
-
-# type foo = int
-# class o : object method x : foo method y : int end
-# class o : object method x : foo method y : int end
-# class o : object method x : int method y : foo end
-#
diff --git a/testsuite/tests/typing-objects/pr5619_bad.ml.reference b/testsuite/tests/typing-objects/pr5619_bad.compilers.reference
index 0b50417a66..bb7557fe63 100644
--- a/testsuite/tests/typing-objects/pr5619_bad.ml.reference
+++ b/testsuite/tests/typing-objects/pr5619_bad.compilers.reference
@@ -1,9 +1,8 @@
-
-# class type foo_t = object method foo : string end
+class type foo_t = object method foo : string end
type 'a name = Foo : foo_t name | Int : int name
-# class foo :
+class foo :
object method cast : foo_t name -> < foo : string > method foo : string end
-# Characters 22-176:
+Characters 22-176:
..object(self)
method foo = "foo"
method cast: type a. a name -> a =
@@ -15,4 +14,4 @@ Error: The class type
object method cast : 'a name -> 'a method foo : string end
is not matched by the class type foo_t
The public method cast cannot be hidden
-#
+
diff --git a/testsuite/tests/typing-objects/pr5619_bad.ml b/testsuite/tests/typing-objects/pr5619_bad.ml
index 8608dd02ef..73b8feb23a 100644
--- a/testsuite/tests/typing-objects/pr5619_bad.ml
+++ b/testsuite/tests/typing-objects/pr5619_bad.ml
@@ -1,3 +1,7 @@
+(* TEST
+ * toplevel
+*)
+
class type foo_t =
object
method foo: string
diff --git a/testsuite/tests/typing-objects/pr5858.ml.reference b/testsuite/tests/typing-objects/pr5858.compilers.reference
index 94e6348447..05ceb35bce 100644
--- a/testsuite/tests/typing-objects/pr5858.ml.reference
+++ b/testsuite/tests/typing-objects/pr5858.compilers.reference
@@ -1,7 +1,6 @@
-
-# class type c = object end
-# Characters 29-30:
+class type c = object end
+Characters 29-30:
module type S = sig class c: c end;;
^
Error: The class type c is not yet completely defined
-#
+
diff --git a/testsuite/tests/typing-objects/pr5858.ml b/testsuite/tests/typing-objects/pr5858.ml
index 3795cf3121..8089546505 100644
--- a/testsuite/tests/typing-objects/pr5858.ml
+++ b/testsuite/tests/typing-objects/pr5858.ml
@@ -1,2 +1,6 @@
+(* TEST
+ * toplevel
+*)
+
class type c = object end;;
module type S = sig class c: c end;;
diff --git a/testsuite/tests/typing-objects/pr6123_bad.ml.reference b/testsuite/tests/typing-objects/pr6123_bad.compilers.reference
index eb3b05c083..6b6d8fc0bc 100644
--- a/testsuite/tests/typing-objects/pr6123_bad.ml.reference
+++ b/testsuite/tests/typing-objects/pr6123_bad.compilers.reference
@@ -1,8 +1,7 @@
-
-# Characters 253-257:
+Characters 279-283:
let args = List.map (fun ty -> new argument(self, ty)) args_ty in
^^^^
Error: This expression has type < arguments : 'a; .. >
but an expression was expected of type 'b
Self type cannot escape its class
-#
+
diff --git a/testsuite/tests/typing-objects/pr6123_bad.ml b/testsuite/tests/typing-objects/pr6123_bad.ml
index a773f8d70e..f311f607b2 100644
--- a/testsuite/tests/typing-objects/pr6123_bad.ml
+++ b/testsuite/tests/typing-objects/pr6123_bad.ml
@@ -1,3 +1,7 @@
+(* TEST
+ * toplevel
+*)
+
class virtual name =
object
end
diff --git a/testsuite/tests/typing-objects/pr6383.ml.reference b/testsuite/tests/typing-objects/pr6383.compilers.reference
index 6c92acc37a..ae74071ba7 100644
--- a/testsuite/tests/typing-objects/pr6383.ml.reference
+++ b/testsuite/tests/typing-objects/pr6383.compilers.reference
@@ -1,6 +1,5 @@
-
-# Characters 11-16:
+Characters 37-42:
let f (x: #M.foo) = 0;;
^^^^^
Error: Unbound module M
-#
+
diff --git a/testsuite/tests/typing-objects/pr6383.ml b/testsuite/tests/typing-objects/pr6383.ml
index bd2fdb06f0..b47e382490 100644
--- a/testsuite/tests/typing-objects/pr6383.ml
+++ b/testsuite/tests/typing-objects/pr6383.ml
@@ -1 +1,5 @@
+(* TEST
+ * toplevel
+*)
+
let f (x: #M.foo) = 0;;
diff --git a/testsuite/tests/typing-objects/pr6907_bad.ml.reference b/testsuite/tests/typing-objects/pr6907_bad.compilers.reference
index 3a4ef9af2b..ffe1e02624 100644
--- a/testsuite/tests/typing-objects/pr6907_bad.ml.reference
+++ b/testsuite/tests/typing-objects/pr6907_bad.compilers.reference
@@ -1,10 +1,9 @@
-
-# class type ['e] t = object ('a) method update : 'e -> 'a end
-# Characters 23-48:
+class type ['e] t = object ('a) method update : 'e -> 'a end
+Characters 23-48:
class base : 'e -> ['e] t
^^^^^^^^^^^^^^^^^^^^^^^^^
Error: Some type variables are unbound in this type:
class base : 'e -> ['e] t
The method update has type 'e -> < update : 'a; .. > as 'a where 'e
is unbound
-#
+
diff --git a/testsuite/tests/typing-objects/pr6907_bad.ml b/testsuite/tests/typing-objects/pr6907_bad.ml
index 0a9a7a1dd3..44a15fe1ea 100644
--- a/testsuite/tests/typing-objects/pr6907_bad.ml
+++ b/testsuite/tests/typing-objects/pr6907_bad.ml
@@ -1,3 +1,7 @@
+(* TEST
+ * toplevel
+*)
+
class type ['e] t = object('s)
method update : 'e -> 's
end;;