summaryrefslogtreecommitdiff
path: root/testlabl
diff options
context:
space:
mode:
Diffstat (limited to 'testlabl')
-rw-r--r--testlabl/poly.exp22
-rw-r--r--testlabl/poly.exp222
-rw-r--r--testlabl/poly.ml20
3 files changed, 60 insertions, 4 deletions
diff --git a/testlabl/poly.exp b/testlabl/poly.exp
index 8df92e4445..2b3faffa58 100644
--- a/testlabl/poly.exp
+++ b/testlabl/poly.exp
@@ -1,4 +1,4 @@
- Objective Caml version 3.07+4 (2003-11-07)
+ Objective Caml version 3.07+19 (2004-05-26)
# * * * # type 'a t = { t : 'a; }
# type 'a fold = { fold : 'b. f:('b -> 'a -> 'b) -> init:'b -> 'b; }
@@ -322,11 +322,29 @@ Warning: the following private methods were made public implicitly:
n
val f : unit -> < m : int; n : int > = <fun>
# Characters 11-56:
-This object is expected to have type c = < m : int > but has actually type
+This object is expected to have type c but has actually type
< m : int; n : 'a >
Only the second object type has a method n
# Characters 11-69:
This object is expected to have type < n : int > but has actually type
< m : 'a >
Only the first object type has a method n
+# Characters 66-124:
+This object is expected to have type < x : int; .. > but has actually type
+ < x : int >
+Self type cannot be unified with a closed object type
+# val o : < x : int > = <obj>
+# Characters 76-77:
+This expression has type < m : 'b. 'b * < m : 'b * 'a > > as 'a
+but is here used with type
+ < m : 'b. 'b * (< m : 'b * < m : 'd. 'd * 'c > > as 'c) >
+Types for method m are incompatible
+# Characters 176-177:
+This expression has type foo' = < m : 'a. 'a * 'a foo >
+but is here used with type bar' = < m : 'a. 'a * 'a bar >
+Type 'a foo = < m : 'a * 'a foo > is not compatible with type
+ 'a bar = < m : 'a * < m : 'b. 'b * 'a bar > >
+Type 'a foo = < m : 'a * 'a foo > is not compatible with type
+ < m : 'b. 'b * 'a bar >
+Types for method m are incompatible
#
diff --git a/testlabl/poly.exp2 b/testlabl/poly.exp2
index 4d5a15d311..dba450e7c5 100644
--- a/testlabl/poly.exp2
+++ b/testlabl/poly.exp2
@@ -1,4 +1,4 @@
- Objective Caml version 3.07+4 (2003-11-07)
+ Objective Caml version 3.07+19 (2004-05-26)
# * * * # type 'a t = { t : 'a; }
# type 'a fold = { fold : 'b. f:('b -> 'a -> 'b) -> init:'b -> 'b; }
@@ -329,11 +329,29 @@ Warning: the following private methods were made public implicitly:
n
val f : unit -> < m : int; n : int > = <fun>
# Characters 11-56:
-This object is expected to have type c = < m : int > but has actually type
+This object is expected to have type c but has actually type
< m : int; n : 'a >
Only the second object type has a method n
# Characters 11-69:
This object is expected to have type < n : int > but has actually type
< m : 'a >
Only the first object type has a method n
+# Characters 66-124:
+This object is expected to have type < x : int; .. > but has actually type
+ < x : int >
+Self type cannot be unified with a closed object type
+# val o : < x : int > = <obj>
+# Characters 76-77:
+This expression has type < m : 'b. 'b * < m : 'b * 'a > > as 'a
+but is here used with type
+ < m : 'b. 'b * (< m : 'b * < m : 'd. 'd * 'c > > as 'c) >
+Types for method m are incompatible
+# Characters 176-177:
+This expression has type foo' = < m : 'a. 'a * 'a foo >
+but is here used with type bar' = < m : 'a. 'a * 'a bar >
+Type 'a foo = < m : 'a * 'a foo > is not compatible with type
+ 'a bar = < m : 'a * < m : 'b. 'b * 'a bar > >
+Type 'a foo = < m : 'a * 'a foo > is not compatible with type
+ < m : 'b. 'b * 'a bar >
+Types for method m are incompatible
#
diff --git a/testlabl/poly.ml b/testlabl/poly.ml
index 3ce1f30e3a..7ee3fd9dbe 100644
--- a/testlabl/poly.ml
+++ b/testlabl/poly.ml
@@ -466,3 +466,23 @@ let f () = object (self:c) method private n = 1 method m = self#n end;;
let f () = object method private n = 1 method m = {<>}#n end;;
let f () = object (self:c) method n = 1 method m = 2 end;;
let f () = object (_:'s) constraint 's = < n : int > method m = 1 end;;
+class c = object (_ : 's)
+ method x = 1
+ method private m =
+ object (self: 's) method x = 3 method private m = self end
+end;;
+let o = object (_ : 's)
+ method x = 1
+ method private m =
+ object (self: 's) method x = 3 method private m = self end
+end;;
+
+
+(* Unsound! *)
+fun (x : <m : 'a. 'a * <m: 'b. 'a * 'foo> > as 'foo) ->
+ (x : <m : 'a. 'a * (<m:'b. 'a * <m:'c. 'c * 'bar> > as 'bar) >);;
+type 'a foo = <m: 'b. 'a * 'a foo>
+type foo' = <m: 'a. 'a * 'a foo>
+type 'a bar = <m: 'b. 'a * <m: 'c. 'c * 'a bar> >
+type bar' = <m: 'a. 'a * 'a bar >
+let f (x : foo') = (x : bar');;