summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--testsuite/Makefile2
-rw-r--r--testsuite/tests/typing-objects/Exemples.ml.reference63
-rw-r--r--testsuite/tests/typing-objects/Tests.ml.reference202
-rw-r--r--testsuite/tests/typing-poly/poly.ml.principal.reference369
-rw-r--r--testsuite/tests/typing-poly/poly.ml.reference356
-rw-r--r--testsuite/tests/typing-private/private.ml.reference55
6 files changed, 524 insertions, 523 deletions
diff --git a/testsuite/Makefile b/testsuite/Makefile
index c7f24808d9..d7a975699c 100644
--- a/testsuite/Makefile
+++ b/testsuite/Makefile
@@ -33,7 +33,7 @@ one: lib
exec-one:
@echo "Running tests from '$$DIR' ..."
- @(cd $(DIR) && $(MAKE) BASEDIR=$(BASEDIR) && cd ../..)
+ @(cd $(DIR) && $(MAKE) TERM=dumb BASEDIR=$(BASEDIR) && cd ../..)
lib: FORCE
@(cd lib && $(MAKE) -s BASEDIR=$(BASEDIR) && cd ..)
diff --git a/testsuite/tests/typing-objects/Exemples.ml.reference b/testsuite/tests/typing-objects/Exemples.ml.reference
index 6faf6fb60c..6be5b69483 100644
--- a/testsuite/tests/typing-objects/Exemples.ml.reference
+++ b/testsuite/tests/typing-objects/Exemples.ml.reference
@@ -24,13 +24,13 @@
# val get_x : < get_x : 'a; .. > -> 'a = <fun>
# val set_x : < set_x : 'a; .. > -> 'a = <fun>
# - : int list = [10; 5]
-# #
- class ref x_init = object
+# Characters 7-96:
+ ......ref x_init = object
val mutable x = x_init
method get = x
method set y = x <- y
- end;;
-Error: Some type variables are unbound in this type:
+ end..
+Error: Some type variables are unbound in this type:
class ref :
'a ->
object
@@ -75,15 +75,18 @@ val c' : color_point circle = <obj>
method move : int -> unit
method set_center : 'a -> unit
end
-# #
- let c'' = new color_circle p;;
-Error: This expression has type point but an expression was expected of type
+# 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>
-# # (c'' :> point circle);; (* Echec *)
-Error: Type
+# Characters 0-21:
+ (c'' :> point circle);; (* Echec *)
+ ^^^^^^^^^^^^^^^^^^^^^
+Error: Type
color_point color_circle =
< center : color_point; color : string; move : int -> unit;
set_center : color_point -> unit >
@@ -91,8 +94,10 @@ val c' : color_point circle = <obj>
point circle =
< center : point; move : int -> unit; set_center : point -> unit >
Type point = point is not a subtype of color_point = color_point
-# # fun x -> (x : color_point color_circle :> point circle);;
-Error: Type
+# Characters 9-55:
+ fun x -> (x : color_point color_circle :> point circle);;
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Error: Type
color_point color_circle =
< center : color_point; color : string; move : int -> unit;
set_center : color_point -> unit >
@@ -110,18 +115,10 @@ Type point = point is not a subtype of color_point = color_point
end
# val p : printable_point = <obj>
# 7- : unit = ()
-# #
- class printable_color_point y c = object (self)
- inherit color_point y c
- inherit printable_point y as super
- method print =
- print_string "(";
- super#print;
- print_string ", ";
- print_string (self#color);
- print_string ")"
- end;;
-Warning 13: the following instance variables are overridden by the class printable_point :
+# Characters 85-102:
+ inherit printable_point y as super
+ ^^^^^^^^^^^^^^^^^
+Warning 13: the following instance variables are overridden by the class printable_point :
x
The behaviour changed in ocaml 3.10 (previous behaviour was hiding.)
class printable_color_point :
@@ -210,8 +207,10 @@ and ['a] cons :
# val c : int_comparable = <obj>
# - : unit = ()
# val c2 : int_comparable2 = <obj>
-# # l#add (c2 :> int_comparable);; (* Echec : 'a comp2 n'est un sous-type *)
-Error: Type
+# Characters 6-28:
+ l#add (c2 :> int_comparable);; (* Echec : 'a comp2 n'est un sous-type *)
+ ^^^^^^^^^^^^^^^^^^^^^^
+Error: Type
int_comparable2 =
< leq : int_comparable2 -> bool; set_x : int -> unit; x : int >
is not a subtype of
@@ -231,8 +230,10 @@ is not a subtype of
end
# val c3 : int_comparable3 = <obj>
# - : unit = ()
-# # (new sorted_list ())#add c3;; (* Echec : leq n'est pas binaire *)
-Error: This expression has type
+# Characters 25-27:
+ (new sorted_list ())#add c3;; (* Echec : leq n'est pas binaire *)
+ ^^
+Error: This expression has type
int_comparable3 =
< leq : int_comparable -> bool; setx : int -> unit; x : int >
but an expression was expected of type
@@ -243,10 +244,10 @@ is not a subtype of
< leq : int_comparable -> bool; setx : int -> unit; x : int >
The first object type has no method setx
# val sort : (#comparable as 'a) list -> 'a list = <fun>
-# # let pr l =
- List.map (fun c -> print_int c#x; print_string " ") l;
- print_newline ();;
-Warning 10: this expression should have type unit.
+# 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
diff --git a/testsuite/tests/typing-objects/Tests.ml.reference b/testsuite/tests/typing-objects/Tests.ml.reference
index 73d8de03e1..74b1c25f94 100644
--- a/testsuite/tests/typing-objects/Tests.ml.reference
+++ b/testsuite/tests/typing-objects/Tests.ml.reference
@@ -4,16 +4,11 @@
= <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
-# # (* 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 *)
-
- (* 'a libre dans classe d *)
- class ['a] c () = object
- method f (x : 'a) = ()
- end and d () = object
+# Characters 238-275:
+ ........d () = object
inherit ['a] c ()
- end;;
-Error: Some type variables are unbound in this type:
+ 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
@@ -24,31 +19,22 @@ 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>
-# * # (* class ['a] c :
- 'a -> object ('a) constraint 'a = < f : 'a; .. > method f : 'a end *)
- (* - : ('a c as 'a) -> 'a = <fun> *)
-
- class x () = object
+# * Characters 134-176:
+ ......x () = object
method virtual f : int
- end;;
-Error: This class should be virtual. The following methods are undefined : f
-# # (* The class x should be virtual: its methods f is undefined *)
-
- (* Methode g en trop *)
- class virtual c ((x : 'a): < f : int >) = object (_ : 'a) end
- and virtual d x = object (_ : 'a)
- inherit c x
- method g = true
- end;;
-Error: This pattern cannot match self: it only matches values of type
+ 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 >
-# #
- (* Contrainte non respectee *)
- class ['a] c () = object
+# 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
+ end..
+Error: The abbreviation c is used with parameters bool c
wich are incompatible with constraints int c
# class ['a, 'b] c :
unit ->
@@ -65,30 +51,33 @@ and ['a] d : unit -> object constraint 'a = int #c end
method f : 'a -> 'b -> unit
end
# val x : '_a list ref = {contents = []}
-# # class ['a] c () = object
+# Characters 6-50:
+ ......['a] c () = object
method f = (x : 'a)
- end;;
-Error: The type of this class,
+ 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
-# #
- (* Abreviations *)
- type 'a c = <f : 'a c; g : 'a d>
- and 'a d = <f : int c>;;
-Error: In the definition of d, type int c should be 'a c
+# 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
-# # type 'a u = 'a
- and 'a t = 'a t u;;
-Error: The type abbreviation t is cyclic
+# Characters 18-32:
+ and 'a t = 'a t u;;
+ ^^^^^^^^^^^^^^
+Error: The type abbreviation t is cyclic
# type 'a u = 'a
-# # type t = t u * t u;;
-Error: The type abbreviation t is cyclic
+# 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>
@@ -153,8 +142,10 @@ and 'a t = 'a t u
and d : unit -> object method f : int end
# class e : unit -> object method f : int end
# - : int = 2
-# # class c () = object val x = - true val y = -. () end;;
-Error: This expression has type bool but an expression was expected of type
+# 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
@@ -171,68 +162,26 @@ and d : unit -> object method f : int end
# - : 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
-# # class e () = object
- val x = 3
- inherit c 5
- val y = 3
- val t = 3
- inherit d 7
- val u = 3
- method x = x
- method y = y
- method z = z
- method t = t
- method u = u
- method a = a
- method b = b
- end;;
-Warning 13: the following instance variables are overridden by the class c :
+# Characters 43-46:
+ 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.)
-# class e () = object
- val x = 3
- inherit c 5
- val y = 3
- val t = 3
- inherit d 7
- val u = 3
- method x = x
- method y = y
- method z = z
- method t = t
- method u = u
- method a = a
- method b = b
- end;;
-
-
-
+Characters 53-58:
+ val y = 3
+ ^^^^^
Warning 13: the instance variable y is overridden.
The behaviour changed in ocaml 3.10 (previous behaviour was hiding.)
-# class e () = object
- val x = 3
- inherit c 5
- val y = 3
- val t = 3
- inherit d 7
- val u = 3
- method x = x
- method y = y
- method z = z
- method t = t
- method u = u
- method a = a
- method b = b
- end;;
-
-
-
-
-
+Characters 81-84:
+ 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 91-96:
+ val u = 3
+ ^^^^^
Warning 13: the instance variable u is overridden.
The behaviour changed in ocaml 3.10 (previous behaviour was hiding.)
class e :
@@ -268,12 +217,12 @@ class e :
# * * * * * * * * * * * * * * * * * * * * * 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)
-# #
- class virtual ['a] matrix (sz, init : int * 'a) = object
+# 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 >
+ 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>
@@ -282,12 +231,11 @@ class e :
# 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
-# # module S = (struct
+# Characters 12-43:
+ ............struct
let f (x : #c) = x
- end : sig
- val f : #c -> #c
- end);;
-Error: Signature mismatch:
+ end......
+Error: Signature mismatch:
Modules do not match:
sig val f : (#c as 'a) -> 'a end
is not included in
@@ -296,31 +244,41 @@ class e :
val f : (#c as 'a) -> 'a
is not included in
val f : #c -> #c
-# #
- module M = struct type t = int class t () = object end end;;
-Error: Multiple definition of the type name t.
+# 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>
-# #
- fun x -> (x : int -> bool :> 'a -> 'a);;
-Error: Type int -> bool is not a subtype of int -> int
-# # fun x -> (x : int -> bool :> int -> int);;
-Error: Type int -> bool is not a subtype of int -> int
+# 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
-# # fun (x : 'a t as 'a) -> ();;
-Error: This alias is bound to type 'a t but is used as an instance of type 'a
-# # fun (x : 'a t) -> (x : 'a); ();;
-Error: This expression has type 'a t but an expression was expected of type
+# 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
+# Characters 19-20:
+ fun (x : 'a t) -> (x : 'a); ();;
+ ^
+Error: This expression has type 'a t but an expression was expected of type
'a
# type 'a t = < x : 'a >
# - : ('a t as 'a) -> unit = <fun>
-# # fun (x : 'a t) -> (x : 'a); ();;
-Warning 10: this expression should have type unit.
+# Characters 18-26:
+ fun (x : 'a t) -> (x : 'a); ();;
+ ^^^^^^^^
+Warning 10: this expression should have type unit.
- : ('a t as 'a) -> unit = <fun>
# class ['a] c :
unit -> object constraint 'a = (< .. > as 'b) -> unit method m : 'a end
diff --git a/testsuite/tests/typing-poly/poly.ml.principal.reference b/testsuite/tests/typing-poly/poly.ml.principal.reference
index 72a4f55106..63281ae0db 100644
--- a/testsuite/tests/typing-poly/poly.ml.principal.reference
+++ b/testsuite/tests/typing-poly/poly.ml.principal.reference
@@ -120,9 +120,10 @@ val cp : color_point = <obj>
val c : circle = <obj>
val d : float = 11.4536240470737098
# val f : < m : 'a. 'a -> 'a > -> < m : 'b. 'b -> 'b > = <fun>
-# # let f (x : < m : 'a. 'a -> 'a list >) = (x : < m : 'b. 'b -> 'c >)
- ;;
-Error: This expression has type < m : 'a. 'a -> 'a list >
+# Characters 41-42:
+ let f (x : < m : 'a. 'a -> 'a list >) = (x : < m : 'b. 'b -> 'c >)
+ ^
+Error: This expression has type < m : 'a. 'a -> 'a list >
but an expression was expected of type < m : 'a. 'a -> 'b >
The universal variable 'a would escape its scope
# class id : object method id : 'a -> 'a end
@@ -130,57 +131,48 @@ val d : float = 11.4536240470737098
# class id_impl : object method id : 'a -> 'a end
# class a : object method m : bool end
and b : object method id : 'a -> 'a end
-# #
- class ['a] id1 = object
- method virtual id : 'b. 'b -> 'a
- method id x = x
- end
- ;;
-Error: This method has type 'a -> 'a which is less general than 'b. 'b -> 'a
-# # class id2 (x : 'a) = object
- method virtual id : 'b. 'b -> 'a
- method id x = x
- end
- ;;
-Error: This method has type 'a -> 'a which is less general than 'b. 'b -> 'a
-# # class id3 x = object
- val x = x
- method virtual id : 'a. 'a -> 'a
- method id _ = x
- end
- ;;
-Error: This method has type 'a -> 'a which is less general than 'b. 'b -> 'b
-# # class id4 () = object
- val mutable r = None
- method virtual id : 'a. 'a -> 'a
- method id x =
+# Characters 72-77:
+ method id x = x
+ ^^^^^
+Error: This method has type 'a -> 'a which is less general than 'b. 'b -> 'a
+# Characters 75-80:
+ method id x = x
+ ^^^^^
+Error: This method has type 'a -> 'a which is less general than 'b. 'b -> 'a
+# Characters 80-85:
+ method id _ = x
+ ^^^^^
+Error: This method has type 'a -> 'a which is less general than 'b. 'b -> 'b
+# Characters 92-159:
+ ............x =
match r with
None -> r <- Some x; x
- | Some y -> y
- end
- ;;
-Error: This method has type 'a -> 'a which is less general than 'b. 'b -> 'b
+ | Some y -> y
+Error: This method has type 'a -> 'a which is less general than 'b. 'b -> 'b
# class c : object method m : 'a -> 'b -> 'a end
# val f1 : id -> int * bool = <fun>
# val f2 : id -> int * bool = <fun>
-# # let f3 f = f#id 1, f#id true
- ;;
-Error: This expression has type bool but an expression was expected of type
+# Characters 24-28:
+ let f3 f = f#id 1, f#id true
+ ^^^^
+Error: This expression has type bool but an expression was expected of type
int
-# # let f4 f = ignore(f : id); f#id 1, f#id true
- ;;
-Warning 18: this use of a polymorphic method is not principal.
-# let f4 f = ignore(f : id); f#id 1, f#id true
- ;;
-
+# Characters 27-31:
+ let f4 f = ignore(f : id); f#id 1, f#id true
+ ^^^^
+Warning 18: this use of a polymorphic method is not principal.
+Characters 35-39:
+ let f4 f = ignore(f : id); f#id 1, f#id true
+ ^^^^
Warning 18: this use of a polymorphic method is not principal.
val f4 : id -> int * bool = <fun>
# class c : object method m : #id -> int * bool end
# class id2 : object method id : 'a -> 'a method mono : int -> int end
# val app : int * bool = (1, true)
-# # type 'a foo = 'a foo list
- ;;
-Error: The type abbreviation foo is cyclic
+# Characters 4-25:
+ type 'a foo = 'a foo list
+ ^^^^^^^^^^^^^^^^^^^^^
+Error: The type abbreviation foo is cyclic
# class ['a] bar : 'a -> object end
# type 'a foo = 'a foo bar
# - : (< m : 'b. 'b * 'a > as 'a) -> 'c * (< m : 'e. 'e * 'd > as 'd) = <fun>
@@ -249,13 +241,17 @@ class next : #numeral -> object method fold : ('a -> 'a) -> 'a -> 'a end
# class node : node_type
# class node : object method as_variant : [> `Node of node_type ] end
# type bad = { bad : 'a. 'a option ref; }
-# # let bad = {bad = ref None};;
-Error: This field value has type 'a option ref which is less general than
+# Characters 17-25:
+ let bad = {bad = ref None};;
+ ^^^^^^^^
+Error: This field value has type 'a option ref which is less general than
'b. 'b option ref
# type bad2 = { mutable bad2 : 'a. 'a option ref option; }
# val bad2 : bad2 = {bad2 = None}
-# # bad2.bad2 <- Some (ref None);;
-Error: This field value has type 'a option ref option
+# Characters 13-28:
+ bad2.bad2 <- Some (ref None);;
+ ^^^^^^^^^^^^^^^
+Error: This field value has type 'a option ref option
which is less general than 'b. 'b option ref option
# val f : < m : 'a. < p : 'a * 'b > as 'b > -> 'c -> unit = <fun>
# val f :
@@ -266,48 +262,49 @@ class next : #numeral -> object method fold : ('a -> 'a) -> 'a -> 'a end
# class c : object method m : ([> 'a t ] as 'a) -> unit end
# class c : object method m : ([> 'a t ] as 'a) -> 'a end
# class c : object method m : ([> `A ] as 'a) option -> 'a end
-# #
- (* various old bugs *)
- class virtual ['a] visitor =
- object method virtual caseNil : 'a end
- and virtual int_list =
- object method virtual visit : 'a.('a visitor -> 'a) end;;
-Error: This type scheme cannot quantify 'a :
+# Characters 145-166:
+ object method virtual visit : 'a.('a visitor -> 'a) end;;
+ ^^^^^^^^^^^^^^^^^^^^^
+Error: This type scheme cannot quantify 'a :
it escapes this scope.
# type ('a, 'b) list_visitor = < caseCons : 'b -> 'b list -> 'a; caseNil : 'a >
type 'a alist = < visit : 'b. ('b, 'a) list_visitor -> 'b >
class type ct = object ('a) method fold : ('b -> 'a -> 'b) -> 'b -> 'b end
type t = { f : 'a 'b. ('b -> (#ct as 'a) -> 'b) -> 'b; }
-# #
- (* PR#1663 *)
- type t = u and u = t;;
-Error: The type abbreviation t is cyclic
+# Characters 20-25:
+ type t = u and u = t;;
+ ^^^^^
+Error: The type abbreviation t is cyclic
# class ['a] a : object constraint 'a = [> `A of 'a a ] end
type t = [ `A of t a ]
-# #
- (* Wrong in 3.06 *)
- type ('a,'b) t constraint 'a = 'b and ('a,'b) u = ('a,'b) t;;
-Error: Constraints are not satisfied in this type.
+# Characters 71-80:
+ type ('a,'b) t constraint 'a = 'b and ('a,'b) u = ('a,'b) t;;
+ ^^^^^^^^^
+Error: Constraints are not satisfied in this type.
Type ('a, 'b) t should be an instance of ('c, 'c) t
# type 'a t = 'a
and u = int t
# type 'a t constraint 'a = int
-# # type 'a u = 'a and 'a v = 'a u t;;
-Error: Constraints are not satisfied in this type.
+# Characters 26-32:
+ type 'a u = 'a and 'a v = 'a u t;;
+ ^^^^^^
+Error: Constraints are not satisfied in this type.
Type 'a u t should be an instance of int t
# type 'a u = 'a constraint 'a = int
and 'a v = 'a u t constraint 'a = int
# type g = int
# type 'a t = unit constraint 'a = g
-# # type 'a u = 'a and 'a v = 'a u t;;
-Error: Constraints are not satisfied in this type.
+# Characters 26-32:
+ type 'a u = 'a and 'a v = 'a u t;;
+ ^^^^^^
+Error: Constraints are not satisfied in this type.
Type 'a u t should be an instance of g t
# type 'a u = 'a constraint 'a = g
and 'a v = 'a u t constraint 'a = int
-# #
- (* Example of wrong expansion *)
- type 'a u = < m : 'a v > and 'a v = 'a list u;;
-Error: In the definition of v, type 'a list u should be 'a u
+# Characters 38-58:
+ type 'a u = < m : 'a v > and 'a v = 'a list u;;
+ ^^^^^^^^^^^^^^^^^^^^
+Error: In the definition of v, type 'a list u should be 'a u
# type 'a t = 'a
type 'a u = A of 'a t
# type 'a t = < a : 'a >
@@ -320,36 +317,39 @@ type 'a u = A of 'a t
# - : [> `A ] option * t -> int = <fun>
# - : t * [< `A | `B ] -> int = <fun>
# - : [< `A | `B ] * t -> int = <fun>
-# # function (`A|`B), _ -> 0 | _,(`A|`B) -> 1;;
-Warning 8: this pattern-matching is not exhaustive.
+# Characters 0-41:
+ function (`A|`B), _ -> 0 | _,(`A|`B) -> 1;;
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Warning 8: this pattern-matching is not exhaustive.
Here is an example of a value that is not matched:
(`AnyExtraTag, `AnyExtraTag)
- : [> `A | `B ] * [> `A | `B ] -> int = <fun>
-# # function `B,1 -> 1 | _,1 -> 2;;
-Warning 8: this pattern-matching is not exhaustive.
+# Characters 0-29:
+ function `B,1 -> 1 | _,1 -> 2;;
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Warning 8: this pattern-matching is not exhaustive.
Here is an example of a value that is not matched:
(_, 0)
-# function `B,1 -> 1 | _,1 -> 2;;
-
-
-
+Characters 21-24:
+ function `B,1 -> 1 | _,1 -> 2;;
+ ^^^
Warning 11: this match case is unused.
- : [< `B ] * int -> int = <fun>
-# # function 1,`B -> 1 | 1,_ -> 2;;
-Warning 8: this pattern-matching is not exhaustive.
+# Characters 0-29:
+ function 1,`B -> 1 | 1,_ -> 2;;
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Warning 8: this pattern-matching is not exhaustive.
Here is an example of a value that is not matched:
(0, _)
-# function 1,`B -> 1 | 1,_ -> 2;;
-
-
-
+Characters 21-24:
+ function 1,`B -> 1 | 1,_ -> 2;;
+ ^^^
Warning 11: this match case is unused.
- : int * [< `B ] -> int = <fun>
-# #
- (* pass typetexp, but fails during Typedecl.check_recursion *)
- type ('a, 'b) a = 'a -> unit constraint 'a = [> `B of ('a, 'b) b as 'b]
- and ('a, 'b) b = 'b -> unit constraint 'b = [> `A of ('a, 'b) a as 'a];;
-Error: Constraints are not satisfied in this type.
+# Characters 69-135:
+ type ('a, 'b) a = 'a -> unit constraint 'a = [> `B of ('a, 'b) b as 'b]
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Error: Constraints are not satisfied in this type.
Type
([> `B of 'a ], 'a) b as 'a
should be an instance of
@@ -384,79 +384,80 @@ type bt = 'a ca cb as 'a
# class c : object method m : int end
# val f : unit -> c = <fun>
# val f : unit -> c = <fun>
-# # let f () = object method private n = 1 method m = {<>}#n end;;
-Warning 15: the following private methods were made public implicitly:
+# Characters 11-60:
+ let f () = object method private n = 1 method m = {<>}#n end;;
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Warning 15: the following private methods were made public implicitly:
n.
val f : unit -> < m : int; n : int > = <fun>
-# # let f () = object (self:c) method n = 1 method m = 2 end;;
-Error: This object is expected to have type c but actually has type
+# Characters 11-56:
+ let f () = object (self:c) method n = 1 method m = 2 end;;
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Error: This object is expected to have type c but actually has type
< m : int; n : 'a >
The first object type has no method n
-# # let f () = object (_:'s) constraint 's = < n : int > method m = 1 end;;
-Error: This object is expected to have type < n : int > but actually has type
+# Characters 11-69:
+ let f () = object (_:'s) constraint 's = < n : int > method m = 1 end;;
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Error: This object is expected to have type < n : int > but actually has type
< m : 'a >
The second object type has no method n
-# # class c = object (_ : 's)
- method x = 1
- method private m =
- object (self: 's) method x = 3 method private m = self end
- end;;
-Error: This object is expected to have type < x : int; .. >
+# Characters 66-124:
+ object (self: 's) method x = 3 method private m = self end
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Error: This object is expected to have type < x : int; .. >
but actually has type < x : int >
Self type cannot be unified with a closed object type
# val o : < x : int > = <obj>
-# #
-
- (* 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) >);;
-Error: This expression has type < m : 'b. 'b * < m : 'b * 'a > > as 'a
+# Characters 76-77:
+ (x : <m : 'a. 'a * (<m:'b. 'a * <m:'c. 'c * 'bar> > as 'bar) >);;
+ ^
+Error: This expression has type < m : 'b. 'b * < m : 'b * 'a > > as 'a
but an expression was expected of type
< m : 'b. 'b * (< m : 'b * < m : 'd. 'd * 'c > > as 'c) >
Types for method m are incompatible
-# # 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');;
-Error: This expression has type foo' = < m : 'a. 'a * 'a foo >
+# Characters 176-177:
+ let f (x : foo') = (x : bar');;
+ ^
+Error: This expression has type foo' = < m : 'a. 'a * 'a foo >
but an expression was expected of 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
-# #
- fun (x : <m : 'a. 'a * ('a * <m : 'a. 'a * 'foo> as 'foo)>) ->
- (x : <m : 'b. 'b * ('b * <m : 'c. 'c * ('c * 'bar)>)> as 'bar);;
-Error: This expression has type
+# Characters 67-68:
+ (x : <m : 'b. 'b * ('b * <m : 'c. 'c * ('c * 'bar)>)> as 'bar);;
+ ^
+Error: This expression has type
< m : 'a. 'a * ('a * < m : 'c. 'c * 'b > as 'b) >
but an expression was expected of type
< m : 'a. 'a * ('a * < m : 'c. 'c * ('c * 'd) >) > as 'd
Types for method m are incompatible
-# # fun (x : <m : 'a. 'a * ('a * <m : 'a. 'a * 'foo> as 'foo)>) ->
- (x : <m : 'b. 'b * ('b * <m : 'c. 'c * ('b * 'bar)>)> as 'bar);;
-Error: This expression has type
+# Characters 66-67:
+ (x : <m : 'b. 'b * ('b * <m : 'c. 'c * ('b * 'bar)>)> as 'bar);;
+ ^
+Error: This expression has type
< m : 'a. 'a * ('a * < m : 'c. 'c * 'b > as 'b) >
but an expression was expected of type
< m : 'a. 'a * ('a * < m : 'c. 'c * ('a * 'd) >) > as 'd
Types for method m are incompatible
-# # fun (x : <m : 'a. 'a * ('a * 'foo)> as 'foo) ->
- (x : <m : 'b. 'b * ('b * <m:'c. 'c * 'bar> as 'bar)>);;
-Error: This expression has type < m : 'b. 'b * ('b * 'a) > as 'a
+# Characters 51-52:
+ (x : <m : 'b. 'b * ('b * <m:'c. 'c * 'bar> as 'bar)>);;
+ ^
+Error: This expression has type < m : 'b. 'b * ('b * 'a) > as 'a
but an expression was expected of type
< m : 'b. 'b * ('b * < m : 'd. 'd * 'c > as 'c) >
Types for method m are incompatible
-# # let f x =
- (x : <m : 'a. 'a -> ('a * <m:'c. 'c -> 'bar> as 'bar)>
- :> <m : 'a. 'a -> ('a * 'foo)> as 'foo);;
-Error: Type < m : 'a. 'a -> ('a * (< m : 'd. 'd -> 'b as 'e > as 'c) as 'b) >
+# Characters 14-115:
+ ....(x : <m : 'a. 'a -> ('a * <m:'c. 'c -> 'bar> as 'bar)>
+ :> <m : 'a. 'a -> ('a * 'foo)> as 'foo)..
+Error: Type < m : 'a. 'a -> ('a * (< m : 'd. 'd -> 'b as 'e > as 'c) as 'b) >
is not a subtype of < m : 'a. 'a -> ('a * 'f as 'h) as 'g > as 'f
-# #
- module M
- : sig val f : (<m : 'b. 'b * ('b * <m:'c. 'c * 'bar> as 'bar)>) -> unit end
- = struct let f (x : <m : 'a. 'a * ('a * 'foo)> as 'foo) = () end;;
-Error: Signature mismatch:
+# Characters 88-150:
+ = struct let f (x : <m : 'a. 'a * ('a * 'foo)> as 'foo) = () end;;
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Error: Signature mismatch:
Modules do not match:
sig val f : (< m : 'b. 'b * ('b * 'a) > as 'a) -> unit end
is not included in
@@ -467,10 +468,10 @@ val f : unit -> < m : int; n : int > = <fun>
val f : (< m : 'b. 'b * ('b * 'a) > as 'a) -> unit
is not included in
val f : < m : 'a. 'a * ('a * < m : 'c. 'c * 'b > as 'b) > -> unit
-# # module M
- : sig type t = <m : 'b. 'b * ('b * <m:'c. 'c * 'bar> as 'bar)> end
- = struct type t = <m : 'a. 'a * ('a * 'foo)> as 'foo end;;
-Error: Signature mismatch:
+# Characters 78-132:
+ = struct type t = <m : 'a. 'a * ('a * 'foo)> as 'foo end;;
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Error: Signature mismatch:
Modules do not match:
sig type t = < m : 'b. 'b * ('b * 'a) > as 'a end
is not included in
@@ -490,40 +491,48 @@ val f : unit -> < m : int; n : int > = <fun>
# - : t -> v = <fun>
# type u = private [< t ]
# - : u -> v = <fun>
-# # fun x -> (x : v :> u);;
-Error: Type v = [> `A | `B ] is not a subtype of u = [< `A | `B ]
+# Characters 9-21:
+ fun x -> (x : v :> u);;
+ ^^^^^^^^^^^^
+Error: Type v = [> `A | `B ] is not a subtype of u = [< `A | `B ]
# type v = private [< t ]
-# # fun x -> (x : u :> v);;
-Error: Type u = [< `A | `B ] is not a subtype of v = [< `A | `B ]
+# Characters 9-21:
+ fun x -> (x : u :> v);;
+ ^^^^^^^^^^^^
+Error: Type u = [< `A | `B ] is not a subtype of v = [< `A | `B ]
# type p = < x : p >
# type q = private < x : p; .. >
# - : q -> p = <fun>
-# # fun x -> (x : p :> q);;
-Error: Type p = < x : p > is not a subtype of q = < x : p; .. >
-# #
- let f1 x =
- (x : <m:'a. (<p:int;..> as 'a) -> int>
- :> <m:'b. (<p:int;q:int;..> as 'b) -> int>);;
-Error: Type < m : 'a. (< p : int; .. > as 'a) -> int > is not a subtype of
+# Characters 9-21:
+ fun x -> (x : p :> q);;
+ ^^^^^^^^^^^^
+Error: Type p = < x : p > is not a subtype of q = < x : p; .. >
+# Characters 14-100:
+ ..(x : <m:'a. (<p:int;..> as 'a) -> int>
+ :> <m:'b. (<p:int;q:int;..> as 'b) -> int>)..
+Error: Type < m : 'a. (< p : int; .. > as 'a) -> int > is not a subtype of
< m : 'b. (< p : int; q : int; .. > as 'b) -> int >
# val f2 :
< m : 'a. (< p : < a : int >; .. > as 'a) -> int > ->
< m : 'a. (< p : < a : int; b : int >; .. > as 'a) -> int > = <fun>
-# # let f3 x =
- (x : <m:'a. (<p:<a:int;b:int>;..> as 'a) -> int>
- :> <m:'b. (<p:<a:int>;..> as 'b) -> int>);;
-Error: Type < m : 'a. (< p : < a : int; b : int >; .. > as 'a) -> int >
+# Characters 13-107:
+ ..(x : <m:'a. (<p:<a:int;b:int>;..> as 'a) -> int>
+ :> <m:'b. (<p:<a:int>;..> as 'b) -> int>)..
+Error: Type < m : 'a. (< p : < a : int; b : int >; .. > as 'a) -> int >
is not a subtype of < m : 'a. (< p : < a : int >; .. > as 'a) -> int >
-# # let f4 x = (x : <p:<a:int;b:int>;..> :> <p:<a:int>;..>);;
-Error: Type < p : < a : int; b : int >; .. > is not a subtype of
+# Characters 11-55:
+ let f4 x = (x : <p:<a:int;b:int>;..> :> <p:<a:int>;..>);;
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Error: Type < p : < a : int; b : int >; .. > is not a subtype of
< p : < a : int >; .. >
The second object type has no method b
# val f5 :
< m : 'a. [< `A of < p : int > ] as 'a > ->
< m : 'a. [< `A of < > ] as 'a > = <fun>
-# # let f6 x =
- (x : <m:'a. [< `A of < > ] as 'a> :> <m:'a. [< `A of <p:int> ] as 'a>);;
-Error: Type < m : 'a. [< `A of < > ] as 'a > is not a subtype of
+# Characters 13-83:
+ (x : <m:'a. [< `A of < > ] as 'a> :> <m:'a. [< `A of <p:int> ] as 'a>);;
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Error: Type < m : 'a. [< `A of < > ] as 'a > is not a subtype of
< m : 'a. [< `A of < p : int > ] as 'a >
# class c : object method id : 'a -> 'a end
# type u = c option
@@ -535,36 +544,42 @@ The second object type has no method b
val g : 'a -> int = <fun>
# type 'a t = Leaf of 'a | Node of ('a * 'a) t
# val depth : 'a t -> int = <fun>
-# # let rec depth : 'a. 'a t -> _ =
- function Leaf _ -> 1 | Node x -> 1 + d x
- and d x = depth x;; (* fails *)
-Error: This definition has type 'a t -> int which is less general than
+# Characters 34-74:
+ function Leaf _ -> 1 | Node x -> 1 + d x
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Error: This definition has type 'a t -> int which is less general than
'b. 'b t -> int
-# # let rec depth : 'a. 'a t -> _ =
- function Leaf x -> x | Node x -> 1 + depth x;; (* fails *)
-Error: This definition has type int t -> int which is less general than
+# Characters 34-78:
+ function Leaf x -> x | Node x -> 1 + depth x;; (* fails *)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Error: This definition has type int t -> int which is less general than
'a. 'a t -> int
-# # let rec depth : 'a. 'a t -> _ =
- function Leaf x -> x | Node x -> depth x;; (* fails *)
-Error: This definition has type 'a t -> 'a which is less general than
+# Characters 34-74:
+ function Leaf x -> x | Node x -> depth x;; (* fails *)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Error: This definition has type 'a t -> 'a which is less general than
'b. 'b t -> 'a
-# # let rec depth : 'a 'b. 'a t -> 'b =
- function Leaf x -> x | Node x -> depth x;; (* fails *)
-Error: This definition has type 'a. 'a t -> 'a which is less general than
+# Characters 38-78:
+ function Leaf x -> x | Node x -> depth x;; (* fails *)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Error: This definition has type 'a. 'a t -> 'a which is less general than
'b 'c. 'c t -> 'b
# val r : 'a list * '_b list ref = ([], {contents = []})
val q : unit -> 'a list * '_b list ref = <fun>
# val f : 'a -> 'a = <fun>
# val zero : [> `B of 'a | `Int of int ] as 'a = `Int 0
-# # let zero : 'a. [< `Int of int] as 'a = `Int 0;; (* fails *)
-Error: This expression has type [> `Int of int ]
+# Characters 39-45:
+ let zero : 'a. [< `Int of int] as 'a = `Int 0;; (* fails *)
+ ^^^^^^
+Error: This expression has type [> `Int of int ]
but an expression was expected of type [< `Int of int ]
Types for tag `Int are incompatible
# type t = { f : 'a. [> `B of 'a | `Int of int ] as 'a; }
val zero : t = {f = `Int 0}
-# # type t = {f: 'a. [< `Int of int] as 'a}
- let zero = {f = `Int 0} ;; (* fails *)
-Error: This expression has type [> `Int of int ]
+# Characters 56-62:
+ let zero = {f = `Int 0} ;; (* fails *)
+ ^^^^^^
+Error: This expression has type [> `Int of int ]
but an expression was expected of type [< `Int of int ]
Types for tag `Int are incompatible
# val id : 'a -> 'a = <fun>
@@ -576,7 +591,9 @@ val transf_alist : (int -> t) -> ('a * t) list -> ('a * t) list = <fun>
val l : t = {f = <lazy>}
# type t = { f : 'a. 'a -> unit; }
# - : t = {f = <fun>}
-# # {f=fun ?x y -> y};; (* fail *)
-Error: This field value has type unit -> unit which is less general than
+# Characters 3-16:
+ {f=fun ?x y -> y};; (* fail *)
+ ^^^^^^^^^^^^^
+Error: This field value has type unit -> unit which is less general than
'a. 'a -> unit
#
diff --git a/testsuite/tests/typing-poly/poly.ml.reference b/testsuite/tests/typing-poly/poly.ml.reference
index 75e26f1817..6e4fce853b 100644
--- a/testsuite/tests/typing-poly/poly.ml.reference
+++ b/testsuite/tests/typing-poly/poly.ml.reference
@@ -120,9 +120,10 @@ val cp : color_point = <obj>
val c : circle = <obj>
val d : float = 11.4536240470737098
# val f : < m : 'a. 'a -> 'a > -> < m : 'a. 'a -> 'a > = <fun>
-# # let f (x : < m : 'a. 'a -> 'a list >) = (x : < m : 'b. 'b -> 'c >)
- ;;
-Error: This expression has type < m : 'a. 'a -> 'a list >
+# Characters 41-42:
+ let f (x : < m : 'a. 'a -> 'a list >) = (x : < m : 'b. 'b -> 'c >)
+ ^
+Error: This expression has type < m : 'a. 'a -> 'a list >
but an expression was expected of type < m : 'a. 'a -> 'b >
The universal variable 'a would escape its scope
# class id : object method id : 'a -> 'a end
@@ -130,50 +131,40 @@ val d : float = 11.4536240470737098
# class id_impl : object method id : 'a -> 'a end
# class a : object method m : bool end
and b : object method id : 'a -> 'a end
-# #
- class ['a] id1 = object
- method virtual id : 'b. 'b -> 'a
- method id x = x
- end
- ;;
-Error: This method has type 'a -> 'a which is less general than 'b. 'b -> 'a
-# # class id2 (x : 'a) = object
- method virtual id : 'b. 'b -> 'a
- method id x = x
- end
- ;;
-Error: This method has type 'a -> 'a which is less general than 'b. 'b -> 'a
-# # class id3 x = object
- val x = x
- method virtual id : 'a. 'a -> 'a
- method id _ = x
- end
- ;;
-Error: This method has type 'a -> 'a which is less general than 'b. 'b -> 'b
-# # class id4 () = object
- val mutable r = None
- method virtual id : 'a. 'a -> 'a
- method id x =
+# Characters 72-77:
+ method id x = x
+ ^^^^^
+Error: This method has type 'a -> 'a which is less general than 'b. 'b -> 'a
+# Characters 75-80:
+ method id x = x
+ ^^^^^
+Error: This method has type 'a -> 'a which is less general than 'b. 'b -> 'a
+# Characters 80-85:
+ method id _ = x
+ ^^^^^
+Error: This method has type 'a -> 'a which is less general than 'b. 'b -> 'b
+# Characters 92-159:
+ ............x =
match r with
None -> r <- Some x; x
- | Some y -> y
- end
- ;;
-Error: This method has type 'a -> 'a which is less general than 'b. 'b -> 'b
+ | Some y -> y
+Error: This method has type 'a -> 'a which is less general than 'b. 'b -> 'b
# class c : object method m : 'a -> 'b -> 'a end
# val f1 : id -> int * bool = <fun>
# val f2 : id -> int * bool = <fun>
-# # let f3 f = f#id 1, f#id true
- ;;
-Error: This expression has type bool but an expression was expected of type
+# Characters 24-28:
+ let f3 f = f#id 1, f#id true
+ ^^^^
+Error: This expression has type bool but an expression was expected of type
int
# val f4 : id -> int * bool = <fun>
# class c : object method m : #id -> int * bool end
# class id2 : object method id : 'a -> 'a method mono : int -> int end
# val app : int * bool = (1, true)
-# # type 'a foo = 'a foo list
- ;;
-Error: The type abbreviation foo is cyclic
+# Characters 4-25:
+ type 'a foo = 'a foo list
+ ^^^^^^^^^^^^^^^^^^^^^
+Error: The type abbreviation foo is cyclic
# class ['a] bar : 'a -> object end
# type 'a foo = 'a foo bar
# - : (< m : 'b. 'b * 'a > as 'a) -> 'c * 'a = <fun>
@@ -235,13 +226,17 @@ class next : #numeral -> object method fold : ('a -> 'a) -> 'a -> 'a end
# class node : node_type
# class node : object method as_variant : [> `Node of node_type ] end
# type bad = { bad : 'a. 'a option ref; }
-# # let bad = {bad = ref None};;
-Error: This field value has type 'a option ref which is less general than
+# Characters 17-25:
+ let bad = {bad = ref None};;
+ ^^^^^^^^
+Error: This field value has type 'a option ref which is less general than
'b. 'b option ref
# type bad2 = { mutable bad2 : 'a. 'a option ref option; }
# val bad2 : bad2 = {bad2 = None}
-# # bad2.bad2 <- Some (ref None);;
-Error: This field value has type 'a option ref option
+# Characters 13-28:
+ bad2.bad2 <- Some (ref None);;
+ ^^^^^^^^^^^^^^^
+Error: This field value has type 'a option ref option
which is less general than 'b. 'b option ref option
# val f : < m : 'a. < p : 'a * 'b > as 'b > -> 'c -> unit = <fun>
# val f : < m : 'a. 'a * (< p : int * 'b > as 'b) > -> 'b -> unit = <fun>
@@ -250,48 +245,49 @@ class next : #numeral -> object method fold : ('a -> 'a) -> 'a -> 'a end
# class c : object method m : ([> 'a t ] as 'a) -> unit end
# class c : object method m : ([> 'a t ] as 'a) -> 'a end
# class c : object method m : ([> `A ] as 'a) option -> 'a end
-# #
- (* various old bugs *)
- class virtual ['a] visitor =
- object method virtual caseNil : 'a end
- and virtual int_list =
- object method virtual visit : 'a.('a visitor -> 'a) end;;
-Error: This type scheme cannot quantify 'a :
+# Characters 145-166:
+ object method virtual visit : 'a.('a visitor -> 'a) end;;
+ ^^^^^^^^^^^^^^^^^^^^^
+Error: This type scheme cannot quantify 'a :
it escapes this scope.
# type ('a, 'b) list_visitor = < caseCons : 'b -> 'b list -> 'a; caseNil : 'a >
type 'a alist = < visit : 'b. ('b, 'a) list_visitor -> 'b >
class type ct = object ('a) method fold : ('b -> 'a -> 'b) -> 'b -> 'b end
type t = { f : 'a 'b. ('b -> (#ct as 'a) -> 'b) -> 'b; }
-# #
- (* PR#1663 *)
- type t = u and u = t;;
-Error: The type abbreviation t is cyclic
+# Characters 20-25:
+ type t = u and u = t;;
+ ^^^^^
+Error: The type abbreviation t is cyclic
# class ['a] a : object constraint 'a = [> `A of 'a a ] end
type t = [ `A of t a ]
-# #
- (* Wrong in 3.06 *)
- type ('a,'b) t constraint 'a = 'b and ('a,'b) u = ('a,'b) t;;
-Error: Constraints are not satisfied in this type.
+# Characters 71-80:
+ type ('a,'b) t constraint 'a = 'b and ('a,'b) u = ('a,'b) t;;
+ ^^^^^^^^^
+Error: Constraints are not satisfied in this type.
Type ('a, 'b) t should be an instance of ('c, 'c) t
# type 'a t = 'a
and u = int t
# type 'a t constraint 'a = int
-# # type 'a u = 'a and 'a v = 'a u t;;
-Error: Constraints are not satisfied in this type.
+# Characters 26-32:
+ type 'a u = 'a and 'a v = 'a u t;;
+ ^^^^^^
+Error: Constraints are not satisfied in this type.
Type 'a u t should be an instance of int t
# type 'a u = 'a constraint 'a = int
and 'a v = 'a u t constraint 'a = int
# type g = int
# type 'a t = unit constraint 'a = g
-# # type 'a u = 'a and 'a v = 'a u t;;
-Error: Constraints are not satisfied in this type.
+# Characters 26-32:
+ type 'a u = 'a and 'a v = 'a u t;;
+ ^^^^^^
+Error: Constraints are not satisfied in this type.
Type 'a u t should be an instance of g t
# type 'a u = 'a constraint 'a = g
and 'a v = 'a u t constraint 'a = int
-# #
- (* Example of wrong expansion *)
- type 'a u = < m : 'a v > and 'a v = 'a list u;;
-Error: In the definition of v, type 'a list u should be 'a u
+# Characters 38-58:
+ type 'a u = < m : 'a v > and 'a v = 'a list u;;
+ ^^^^^^^^^^^^^^^^^^^^
+Error: In the definition of v, type 'a list u should be 'a u
# type 'a t = 'a
type 'a u = A of 'a t
# type 'a t = < a : 'a >
@@ -304,36 +300,39 @@ type 'a u = A of 'a t
# - : [> `A ] option * t -> int = <fun>
# - : t * [< `A | `B ] -> int = <fun>
# - : [< `A | `B ] * t -> int = <fun>
-# # function (`A|`B), _ -> 0 | _,(`A|`B) -> 1;;
-Warning 8: this pattern-matching is not exhaustive.
+# Characters 0-41:
+ function (`A|`B), _ -> 0 | _,(`A|`B) -> 1;;
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Warning 8: this pattern-matching is not exhaustive.
Here is an example of a value that is not matched:
(`AnyExtraTag, `AnyExtraTag)
- : [> `A | `B ] * [> `A | `B ] -> int = <fun>
-# # function `B,1 -> 1 | _,1 -> 2;;
-Warning 8: this pattern-matching is not exhaustive.
+# Characters 0-29:
+ function `B,1 -> 1 | _,1 -> 2;;
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Warning 8: this pattern-matching is not exhaustive.
Here is an example of a value that is not matched:
(_, 0)
-# function `B,1 -> 1 | _,1 -> 2;;
-
-
-
+Characters 21-24:
+ function `B,1 -> 1 | _,1 -> 2;;
+ ^^^
Warning 11: this match case is unused.
- : [< `B ] * int -> int = <fun>
-# # function 1,`B -> 1 | 1,_ -> 2;;
-Warning 8: this pattern-matching is not exhaustive.
+# Characters 0-29:
+ function 1,`B -> 1 | 1,_ -> 2;;
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Warning 8: this pattern-matching is not exhaustive.
Here is an example of a value that is not matched:
(0, _)
-# function 1,`B -> 1 | 1,_ -> 2;;
-
-
-
+Characters 21-24:
+ function 1,`B -> 1 | 1,_ -> 2;;
+ ^^^
Warning 11: this match case is unused.
- : int * [< `B ] -> int = <fun>
-# #
- (* pass typetexp, but fails during Typedecl.check_recursion *)
- type ('a, 'b) a = 'a -> unit constraint 'a = [> `B of ('a, 'b) b as 'b]
- and ('a, 'b) b = 'b -> unit constraint 'b = [> `A of ('a, 'b) a as 'a];;
-Error: Constraints are not satisfied in this type.
+# Characters 69-135:
+ type ('a, 'b) a = 'a -> unit constraint 'a = [> `B of ('a, 'b) b as 'b]
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Error: Constraints are not satisfied in this type.
Type
([> `B of 'a ], 'a) b as 'a
should be an instance of
@@ -368,79 +367,80 @@ type bt = 'a ca cb as 'a
# class c : object method m : int end
# val f : unit -> c = <fun>
# val f : unit -> c = <fun>
-# # let f () = object method private n = 1 method m = {<>}#n end;;
-Warning 15: the following private methods were made public implicitly:
+# Characters 11-60:
+ let f () = object method private n = 1 method m = {<>}#n end;;
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Warning 15: the following private methods were made public implicitly:
n.
val f : unit -> < m : int; n : int > = <fun>
-# # let f () = object (self:c) method n = 1 method m = 2 end;;
-Error: This object is expected to have type c but actually has type
+# Characters 11-56:
+ let f () = object (self:c) method n = 1 method m = 2 end;;
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Error: This object is expected to have type c but actually has type
< m : int; n : 'a >
The first object type has no method n
-# # let f () = object (_:'s) constraint 's = < n : int > method m = 1 end;;
-Error: This object is expected to have type < n : int > but actually has type
+# Characters 11-69:
+ let f () = object (_:'s) constraint 's = < n : int > method m = 1 end;;
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Error: This object is expected to have type < n : int > but actually has type
< m : 'a >
The second object type has no method n
-# # class c = object (_ : 's)
- method x = 1
- method private m =
- object (self: 's) method x = 3 method private m = self end
- end;;
-Error: This object is expected to have type < x : int; .. >
+# Characters 66-124:
+ object (self: 's) method x = 3 method private m = self end
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Error: This object is expected to have type < x : int; .. >
but actually has type < x : int >
Self type cannot be unified with a closed object type
# val o : < x : int > = <obj>
-# #
-
- (* 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) >);;
-Error: This expression has type < m : 'b. 'b * < m : 'b * 'a > > as 'a
+# Characters 76-77:
+ (x : <m : 'a. 'a * (<m:'b. 'a * <m:'c. 'c * 'bar> > as 'bar) >);;
+ ^
+Error: This expression has type < m : 'b. 'b * < m : 'b * 'a > > as 'a
but an expression was expected of type
< m : 'b. 'b * (< m : 'b * < m : 'd. 'd * 'c > > as 'c) >
Types for method m are incompatible
-# # 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');;
-Error: This expression has type foo' = < m : 'a. 'a * 'a foo >
+# Characters 176-177:
+ let f (x : foo') = (x : bar');;
+ ^
+Error: This expression has type foo' = < m : 'a. 'a * 'a foo >
but an expression was expected of 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
-# #
- fun (x : <m : 'a. 'a * ('a * <m : 'a. 'a * 'foo> as 'foo)>) ->
- (x : <m : 'b. 'b * ('b * <m : 'c. 'c * ('c * 'bar)>)> as 'bar);;
-Error: This expression has type
+# Characters 67-68:
+ (x : <m : 'b. 'b * ('b * <m : 'c. 'c * ('c * 'bar)>)> as 'bar);;
+ ^
+Error: This expression has type
< m : 'a. 'a * ('a * < m : 'c. 'c * 'b > as 'b) >
but an expression was expected of type
< m : 'a. 'a * ('a * < m : 'c. 'c * ('c * 'd) >) > as 'd
Types for method m are incompatible
-# # fun (x : <m : 'a. 'a * ('a * <m : 'a. 'a * 'foo> as 'foo)>) ->
- (x : <m : 'b. 'b * ('b * <m : 'c. 'c * ('b * 'bar)>)> as 'bar);;
-Error: This expression has type
+# Characters 66-67:
+ (x : <m : 'b. 'b * ('b * <m : 'c. 'c * ('b * 'bar)>)> as 'bar);;
+ ^
+Error: This expression has type
< m : 'a. 'a * ('a * < m : 'c. 'c * 'b > as 'b) >
but an expression was expected of type
< m : 'a. 'a * ('a * < m : 'c. 'c * ('a * 'd) >) > as 'd
Types for method m are incompatible
-# # fun (x : <m : 'a. 'a * ('a * 'foo)> as 'foo) ->
- (x : <m : 'b. 'b * ('b * <m:'c. 'c * 'bar> as 'bar)>);;
-Error: This expression has type < m : 'b. 'b * ('b * 'a) > as 'a
+# Characters 51-52:
+ (x : <m : 'b. 'b * ('b * <m:'c. 'c * 'bar> as 'bar)>);;
+ ^
+Error: This expression has type < m : 'b. 'b * ('b * 'a) > as 'a
but an expression was expected of type
< m : 'b. 'b * ('b * < m : 'd. 'd * 'c > as 'c) >
Types for method m are incompatible
-# # let f x =
- (x : <m : 'a. 'a -> ('a * <m:'c. 'c -> 'bar> as 'bar)>
- :> <m : 'a. 'a -> ('a * 'foo)> as 'foo);;
-Error: Type < m : 'a. 'a -> ('a * (< m : 'd. 'd -> 'b as 'e > as 'c) as 'b) >
+# Characters 14-115:
+ ....(x : <m : 'a. 'a -> ('a * <m:'c. 'c -> 'bar> as 'bar)>
+ :> <m : 'a. 'a -> ('a * 'foo)> as 'foo)..
+Error: Type < m : 'a. 'a -> ('a * (< m : 'd. 'd -> 'b as 'e > as 'c) as 'b) >
is not a subtype of < m : 'a. 'a -> ('a * 'f as 'h) as 'g > as 'f
-# #
- module M
- : sig val f : (<m : 'b. 'b * ('b * <m:'c. 'c * 'bar> as 'bar)>) -> unit end
- = struct let f (x : <m : 'a. 'a * ('a * 'foo)> as 'foo) = () end;;
-Error: Signature mismatch:
+# Characters 88-150:
+ = struct let f (x : <m : 'a. 'a * ('a * 'foo)> as 'foo) = () end;;
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Error: Signature mismatch:
Modules do not match:
sig val f : (< m : 'b. 'b * ('b * 'a) > as 'a) -> unit end
is not included in
@@ -451,10 +451,10 @@ val f : unit -> < m : int; n : int > = <fun>
val f : (< m : 'b. 'b * ('b * 'a) > as 'a) -> unit
is not included in
val f : < m : 'a. 'a * ('a * < m : 'c. 'c * 'b > as 'b) > -> unit
-# # module M
- : sig type t = <m : 'b. 'b * ('b * <m:'c. 'c * 'bar> as 'bar)> end
- = struct type t = <m : 'a. 'a * ('a * 'foo)> as 'foo end;;
-Error: Signature mismatch:
+# Characters 78-132:
+ = struct type t = <m : 'a. 'a * ('a * 'foo)> as 'foo end;;
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Error: Signature mismatch:
Modules do not match:
sig type t = < m : 'b. 'b * ('b * 'a) > as 'a end
is not included in
@@ -474,40 +474,48 @@ val f : unit -> < m : int; n : int > = <fun>
# - : t -> v = <fun>
# type u = private [< t ]
# - : u -> v = <fun>
-# # fun x -> (x : v :> u);;
-Error: Type v = [> `A | `B ] is not a subtype of u = [< `A | `B ]
+# Characters 9-21:
+ fun x -> (x : v :> u);;
+ ^^^^^^^^^^^^
+Error: Type v = [> `A | `B ] is not a subtype of u = [< `A | `B ]
# type v = private [< t ]
-# # fun x -> (x : u :> v);;
-Error: Type u = [< `A | `B ] is not a subtype of v = [< `A | `B ]
+# Characters 9-21:
+ fun x -> (x : u :> v);;
+ ^^^^^^^^^^^^
+Error: Type u = [< `A | `B ] is not a subtype of v = [< `A | `B ]
# type p = < x : p >
# type q = private < x : p; .. >
# - : q -> p = <fun>
-# # fun x -> (x : p :> q);;
-Error: Type p = < x : p > is not a subtype of q = < x : p; .. >
-# #
- let f1 x =
- (x : <m:'a. (<p:int;..> as 'a) -> int>
- :> <m:'b. (<p:int;q:int;..> as 'b) -> int>);;
-Error: Type < m : 'a. (< p : int; .. > as 'a) -> int > is not a subtype of
+# Characters 9-21:
+ fun x -> (x : p :> q);;
+ ^^^^^^^^^^^^
+Error: Type p = < x : p > is not a subtype of q = < x : p; .. >
+# Characters 14-100:
+ ..(x : <m:'a. (<p:int;..> as 'a) -> int>
+ :> <m:'b. (<p:int;q:int;..> as 'b) -> int>)..
+Error: Type < m : 'a. (< p : int; .. > as 'a) -> int > is not a subtype of
< m : 'b. (< p : int; q : int; .. > as 'b) -> int >
# val f2 :
< m : 'a. (< p : < a : int >; .. > as 'a) -> int > ->
< m : 'a. (< p : < a : int; b : int >; .. > as 'a) -> int > = <fun>
-# # let f3 x =
- (x : <m:'a. (<p:<a:int;b:int>;..> as 'a) -> int>
- :> <m:'b. (<p:<a:int>;..> as 'b) -> int>);;
-Error: Type < m : 'a. (< p : < a : int; b : int >; .. > as 'a) -> int >
+# Characters 13-107:
+ ..(x : <m:'a. (<p:<a:int;b:int>;..> as 'a) -> int>
+ :> <m:'b. (<p:<a:int>;..> as 'b) -> int>)..
+Error: Type < m : 'a. (< p : < a : int; b : int >; .. > as 'a) -> int >
is not a subtype of < m : 'a. (< p : < a : int >; .. > as 'a) -> int >
-# # let f4 x = (x : <p:<a:int;b:int>;..> :> <p:<a:int>;..>);;
-Error: Type < p : < a : int; b : int >; .. > is not a subtype of
+# Characters 11-55:
+ let f4 x = (x : <p:<a:int;b:int>;..> :> <p:<a:int>;..>);;
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Error: Type < p : < a : int; b : int >; .. > is not a subtype of
< p : < a : int >; .. >
The second object type has no method b
# val f5 :
< m : 'a. [< `A of < p : int > ] as 'a > ->
< m : 'a. [< `A of < > ] as 'a > = <fun>
-# # let f6 x =
- (x : <m:'a. [< `A of < > ] as 'a> :> <m:'a. [< `A of <p:int> ] as 'a>);;
-Error: Type < m : 'a. [< `A of < > ] as 'a > is not a subtype of
+# Characters 13-83:
+ (x : <m:'a. [< `A of < > ] as 'a> :> <m:'a. [< `A of <p:int> ] as 'a>);;
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Error: Type < m : 'a. [< `A of < > ] as 'a > is not a subtype of
< m : 'a. [< `A of < p : int > ] as 'a >
# class c : object method id : 'a -> 'a end
# type u = c option
@@ -519,36 +527,42 @@ The second object type has no method b
val g : 'a -> int = <fun>
# type 'a t = Leaf of 'a | Node of ('a * 'a) t
# val depth : 'a t -> int = <fun>
-# # let rec depth : 'a. 'a t -> _ =
- function Leaf _ -> 1 | Node x -> 1 + d x
- and d x = depth x;; (* fails *)
-Error: This definition has type 'a t -> int which is less general than
+# Characters 34-74:
+ function Leaf _ -> 1 | Node x -> 1 + d x
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Error: This definition has type 'a t -> int which is less general than
'b. 'b t -> int
-# # let rec depth : 'a. 'a t -> _ =
- function Leaf x -> x | Node x -> 1 + depth x;; (* fails *)
-Error: This definition has type int t -> int which is less general than
+# Characters 34-78:
+ function Leaf x -> x | Node x -> 1 + depth x;; (* fails *)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Error: This definition has type int t -> int which is less general than
'a. 'a t -> int
-# # let rec depth : 'a. 'a t -> _ =
- function Leaf x -> x | Node x -> depth x;; (* fails *)
-Error: This definition has type 'a t -> 'a which is less general than
+# Characters 34-74:
+ function Leaf x -> x | Node x -> depth x;; (* fails *)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Error: This definition has type 'a t -> 'a which is less general than
'b. 'b t -> 'a
-# # let rec depth : 'a 'b. 'a t -> 'b =
- function Leaf x -> x | Node x -> depth x;; (* fails *)
-Error: This definition has type 'a. 'a t -> 'a which is less general than
+# Characters 38-78:
+ function Leaf x -> x | Node x -> depth x;; (* fails *)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Error: This definition has type 'a. 'a t -> 'a which is less general than
'b 'c. 'c t -> 'b
# val r : 'a list * '_b list ref = ([], {contents = []})
val q : unit -> 'a list * '_b list ref = <fun>
# val f : 'a -> 'a = <fun>
# val zero : [> `B of 'a | `Int of int ] as 'a = `Int 0
-# # let zero : 'a. [< `Int of int] as 'a = `Int 0;; (* fails *)
-Error: This expression has type [> `Int of int ]
+# Characters 39-45:
+ let zero : 'a. [< `Int of int] as 'a = `Int 0;; (* fails *)
+ ^^^^^^
+Error: This expression has type [> `Int of int ]
but an expression was expected of type [< `Int of int ]
Types for tag `Int are incompatible
# type t = { f : 'a. [> `B of 'a | `Int of int ] as 'a; }
val zero : t = {f = `Int 0}
-# # type t = {f: 'a. [< `Int of int] as 'a}
- let zero = {f = `Int 0} ;; (* fails *)
-Error: This expression has type [> `Int of int ]
+# Characters 56-62:
+ let zero = {f = `Int 0} ;; (* fails *)
+ ^^^^^^
+Error: This expression has type [> `Int of int ]
but an expression was expected of type [< `Int of int ]
Types for tag `Int are incompatible
# val id : 'a -> 'a = <fun>
@@ -560,7 +574,9 @@ val transf_alist : (int -> t) -> ('a * t) list -> ('a * t) list = <fun>
val l : t = {f = <lazy>}
# type t = { f : 'a. 'a -> unit; }
# - : t = {f = <fun>}
-# # {f=fun ?x y -> y};; (* fail *)
-Error: This field value has type unit -> unit which is less general than
+# Characters 3-16:
+ {f=fun ?x y -> y};; (* fail *)
+ ^^^^^^^^^^^^^
+Error: This field value has type unit -> unit which is less general than
'a. 'a -> unit
#
diff --git a/testsuite/tests/typing-private/private.ml.reference b/testsuite/tests/typing-private/private.ml.reference
index b4e46d0351..f5b85b2055 100644
--- a/testsuite/tests/typing-private/private.ml.reference
+++ b/testsuite/tests/typing-private/private.ml.reference
@@ -1,23 +1,28 @@
# module Foobar : sig type t = private int end
# module F0 : sig type t = private int end
-# #
- let f (x : F0.t) = (x : Foobar.t);; (* fails *)
-Error: This expression has type F0.t but an expression was expected of type
+# Characters 21-22:
+ let f (x : F0.t) = (x : Foobar.t);; (* fails *)
+ ^
+Error: This expression has type F0.t but an expression was expected of type
Foobar.t
# module F : sig type t = Foobar.t end
# val f : F.t -> F.t = <fun>
# module M : sig type t = < m : int > end
# module M1 : sig type t = private < m : int; .. > end
# module M2 : sig type t = private < m : int; .. > end
-# # fun (x : M1.t) -> (x : M2.t);; (* fails *)
-Error: This expression has type M1.t but an expression was expected of type
+# Characters 19-20:
+ fun (x : M1.t) -> (x : M2.t);; (* fails *)
+ ^
+Error: This expression has type M1.t but an expression was expected of type
M2.t
# module M3 : sig type t = private M1.t end
# - : M3.t -> M1.t = <fun>
# - : M3.t -> M.t = <fun>
-# # module M4 : sig type t = private M3.t end = M2;; (* fails *)
-Error: Signature mismatch:
+# Characters 44-46:
+ module M4 : sig type t = private M3.t end = M2;; (* fails *)
+ ^^
+Error: Signature mismatch:
Modules do not match:
sig type t = M2.t end
is not included in
@@ -26,8 +31,10 @@
type t = M2.t
is not included in
type t = private M3.t
-# # module M4 : sig type t = private M3.t end = M;; (* fails *)
-Error: Signature mismatch:
+# Characters 44-45:
+ module M4 : sig type t = private M3.t end = M;; (* fails *)
+ ^
+Error: Signature mismatch:
Modules do not match:
sig type t = < m : int > end
is not included in
@@ -36,8 +43,10 @@
type t = < m : int >
is not included in
type t = private M3.t
-# # module M4 : sig type t = private M3.t end = M1;; (* might be ok *)
-Error: Signature mismatch:
+# Characters 44-46:
+ module M4 : sig type t = private M3.t end = M1;; (* might be ok *)
+ ^^
+Error: Signature mismatch:
Modules do not match:
sig type t = M1.t end
is not included in
@@ -47,8 +56,10 @@
is not included in
type t = private M3.t
# module M5 : sig type t = private M1.t end
-# # module M6 : sig type t = private < n:int; .. > end = M1;; (* fails *)
-Error: Signature mismatch:
+# Characters 53-55:
+ module M6 : sig type t = private < n:int; .. > end = M1;; (* fails *)
+ ^^
+Error: Signature mismatch:
Modules do not match:
sig type t = M1.t end
is not included in
@@ -57,10 +68,10 @@
type t = M1.t
is not included in
type t = private < n : int; .. >
-# #
- module Bar : sig type t = private Foobar.t val f : int -> t end =
- struct type t = int let f (x : int) = (x : t) end;; (* must fail *)
-Error: Signature mismatch:
+# Characters 69-118:
+ struct type t = int let f (x : int) = (x : t) end;; (* must fail *)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Error: Signature mismatch:
Modules do not match:
sig type t = int val f : t -> t end
is not included in
@@ -73,12 +84,10 @@
# module M1 : sig type t = M.t val mk : int -> t end
# module M2 : sig type t = M.t val mk : int -> t end
# module M3 : sig type t = M.t val mk : int -> t end
-# #
- module M4 : sig
- type t = M.t = T of int
- val mk : int -> t
- end = M;;
-Error: This variant or record definition does not match that of type M.t
+# Characters 29-47:
+ type t = M.t = T of int
+ ^^^^^^^^^^^^^^^^^^
+Error: This variant or record definition does not match that of type M.t
A private type would be revealed.
# module M5 : sig type t = M.t = private T of int val mk : int -> t end
# module M6 : sig type t = private T of int val mk : int -> t end