diff options
-rw-r--r-- | testsuite/Makefile | 2 | ||||
-rw-r--r-- | testsuite/tests/typing-objects/Exemples.ml.reference | 63 | ||||
-rw-r--r-- | testsuite/tests/typing-objects/Tests.ml.reference | 202 | ||||
-rw-r--r-- | testsuite/tests/typing-poly/poly.ml.principal.reference | 369 | ||||
-rw-r--r-- | testsuite/tests/typing-poly/poly.ml.reference | 356 | ||||
-rw-r--r-- | testsuite/tests/typing-private/private.ml.reference | 55 |
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] -# [A[A[A[A[A[A# - class [4mref x_init = object +# Characters 7-96: + ......ref x_init = object val mutable x = x_init method get = x method set y = x <- y - end[m;; -[mError: 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 -# [A[A# - let c'' = new color_circle [4mp[m;; -[mError: 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> -# [A# [4m(c'' :> point circle)[m;; (* Echec *) -[mError: 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 -# [A# fun x -> [4m(x : color_point color_circle :> point circle)[m;; -[mError: 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 = () -# [A[A[A[A[A[A[A[A[A[A[A# - class printable_color_point y c = object (self) - inherit color_point y c - inherit [4mprintable_point y[m as super - method print = - print_string "("; - super#print; - print_string ", "; - print_string (self#color); - print_string ")" - end;; -[mWarning 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> -# [A# l#add [4m(c2 :> int_comparable)[m;; (* Echec : 'a comp2 n'est un sous-type *) -[mError: 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 = () -# [A# (new sorted_list ())#add [4mc3[m;; (* Echec : leq n'est pas binaire *) -[mError: 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> -# [A[A[A# let pr l = - [4mList.map (fun c -> print_int c#x; print_string " ") l[m; - print_newline ();; -[mWarning 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 -# [A[A[A[A[A[A[A[A[A# (* 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 [4md () = object +# Characters 238-275: + ........d () = object inherit ['a] c () - end[m;; -[mError: 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> -# * [A[A[A[A[A[A[A# (* class ['a] c : - 'a -> object ('a) constraint 'a = < f : 'a; .. > method f : 'a end *) - (* - : ('a c as 'a) -> 'a = <fun> *) - - class [4mx () = object +# * Characters 134-176: + ......x () = object method virtual f : int - end[m;; -[mError: This class should be virtual. The following methods are undefined : f -# [A[A[A[A[A[A[A[A# (* The class x should be virtual: its methods f is undefined *) - - (* Methode g en trop *) - class virtual c ((x : 'a): < f : int >) = object [4m(_ : 'a)[m end - and virtual d x = object (_ : 'a) - inherit c x - method g = true - end;; -[mError: 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 > -# [A[A[A[A[A[A# - (* Contrainte non respectee *) - class [4m['a] c () = object +# Characters 38-110: + ......['a] c () = object constraint 'a = int method f x = (x : bool c) - end[m;; -[mError: 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 = []} -# [A[A[A# class [4m['a] c () = object +# Characters 6-50: + ......['a] c () = object method f = (x : 'a) - end[m;; -[mError: 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 -# [A[A[A[A# - (* Abreviations *) - type[4m 'a c = <f : 'a c; g : 'a d>[m - and 'a d = <f : int c>;; -[mError: 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 -# [A[A# type 'a u = 'a - and[4m 'a t = 'a t u[m;; -[mError: 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 -# [A# type [4mt = t u * t u[m;; -[mError: 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 -# [A# class c () = object val x = - [4mtrue[m val y = -. () end;; -[mError: 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 -# [A[A[A[A[A[A[A[A[A[A[A[A[A[A[A# class e () = object - val x = 3 - inherit [4mc 5[m - 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;; -[mWarning 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.) -[A[A[A[A[A[A[A[A[A[A[A[A[A[A[A[A[A[A# class e () = object - val x = 3 - inherit c 5 - val [4my = 3[m - 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;; -[m - - +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.) -[A[A[A[A[A[A[A[A[A[A[A[A[A[A[A[A[A[A[A[A# class e () = object - val x = 3 - inherit c 5 - val y = 3 - val t = 3 - inherit [4md 7[m - 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;; -[m - - - - +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) -# [A[A[A[A[A# - class [4mvirtual ['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[m;; -[mError: 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 -# [A[A[A[A[A# module S = ([4mstruct +# Characters 12-43: + ............struct let f (x : #c) = x - end[m : sig - val f : #c -> #c - end);; -[mError: 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 -# [A[A# - module M = struct type t = int [4mclass t () = object end[m end;; -[mError: 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> -# [A[A# - fun x -> [4m(x : int -> bool :> 'a -> 'a)[m;; -[mError: Type int -> bool is not a subtype of int -> int -# [A# fun x -> [4m(x : int -> bool :> int -> int)[m;; -[mError: 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 -# [A# fun (x : [4m'a t as 'a[m) -> ();; -[mError: This alias is bound to type 'a t but is used as an instance of type 'a -# [A# fun (x : 'a t) -> ([4mx[m : 'a); ();; -[mError: 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> -# [A# fun (x : 'a t) -> [4m(x : 'a)[m; ();; -[mWarning 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> -# [A[A# let f (x : < m : 'a. 'a -> 'a list >) = ([4mx[m : < m : 'b. 'b -> 'c >) - ;; -[mError: 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 -# [A[A[A[A[A[A# - class ['a] id1 = object - method virtual id : 'b. 'b -> 'a - method id [4mx = x[m - end - ;; -[mError: This method has type 'a -> 'a which is less general than 'b. 'b -> 'a -# [A[A[A[A[A# class id2 (x : 'a) = object - method virtual id : 'b. 'b -> 'a - method id [4mx = x[m - end - ;; -[mError: This method has type 'a -> 'a which is less general than 'b. 'b -> 'a -# [A[A[A[A[A[A# class id3 x = object - val x = x - method virtual id : 'a. 'a -> 'a - method id [4m_ = x[m - end - ;; -[mError: This method has type 'a -> 'a which is less general than 'b. 'b -> 'b -# [A[A[A[A[A[A[A[A[A# class id4 () = object - val mutable r = None - method virtual id : 'a. 'a -> 'a - method id [4mx = +# 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[m - end - ;; -[mError: 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> -# [A[A# let f3 f = f#id 1, f#id [4mtrue[m - ;; -[mError: 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 -# [A[A# let f4 f = ignore(f : id); [4mf#id[m 1, f#id true - ;; -[mWarning 18: this use of a polymorphic method is not principal. -[A[A[A# let f4 f = ignore(f : id); f#id 1, [4mf#id[m true - ;; -[m +# 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) -# [A[A# type[4m 'a foo = 'a foo list[m - ;; -[mError: 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; } -# [A# let bad = {bad = [4mref None[m};; -[mError: 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} -# [A# bad2.bad2 <- [4mSome (ref None)[m;; -[mError: 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 -# [A[A[A[A[A[A# - (* various old bugs *) - class virtual ['a] visitor = - object method virtual caseNil : 'a end - and virtual int_list = - object method virtual visit : [4m'a.('a visitor -> 'a)[m end;; -[mError: 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; } -# [A[A[A# - (* PR#1663 *) - type [4mt = u[m and u = t;; -[mError: 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 ] -# [A[A[A# - (* Wrong in 3.06 *) - type ('a,'b) t constraint 'a = 'b and ('a,'b) u = [4m('a,'b) t[m;; -[mError: 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 -# [A# type 'a u = 'a and 'a v = [4m'a u t[m;; -[mError: 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 -# [A# type 'a u = 'a and 'a v = [4m'a u t[m;; -[mError: 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 -# [A[A[A# - (* Example of wrong expansion *) - type[4m 'a u = < m : 'a v >[m and 'a v = 'a list u;; -[mError: 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> -# [A# [4mfunction (`A|`B), _ -> 0 | _,(`A|`B) -> 1[m;; -[mWarning 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> -# [A# [4mfunction `B,1 -> 1 | _,1 -> 2[m;; -[mWarning 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) -[A[A[A[A# function `B,1 -> 1 | [4m_,1[m -> 2;; -[m - - +Characters 21-24: + function `B,1 -> 1 | _,1 -> 2;; + ^^^ Warning 11: this match case is unused. - : [< `B ] * int -> int = <fun> -# [A# [4mfunction 1,`B -> 1 | 1,_ -> 2[m;; -[mWarning 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, _) -[A[A[A[A# function 1,`B -> 1 | [4m1,_[m -> 2;; -[m - - +Characters 21-24: + function 1,`B -> 1 | 1,_ -> 2;; + ^^^ Warning 11: this match case is unused. - : int * [< `B ] -> int = <fun> -# [A[A[A[A# - (* pass typetexp, but fails during Typedecl.check_recursion *) - type [4m('a, 'b) a = 'a -> unit constraint 'a = [> `B of ('a, 'b) b as 'b][m - and ('a, 'b) b = 'b -> unit constraint 'b = [> `A of ('a, 'b) a as 'a];; -[mError: 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> -# [A# let f () = [4mobject method private n = 1 method m = {<>}#n end[m;; -[mWarning 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> -# [A# let f () = [4mobject (self:c) method n = 1 method m = 2 end[m;; -[mError: 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 -# [A# let f () = [4mobject (_:'s) constraint 's = < n : int > method m = 1 end[m;; -[mError: 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 -# [A[A[A[A[A# class c = object (_ : 's) - method x = 1 - method private m = - [4mobject (self: 's) method x = 3 method private m = self end[m - end;; -[mError: 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> -# [A[A[A[A[A# - - (* Unsound! *) - fun (x : <m : 'a. 'a * <m: 'b. 'a * 'foo> > as 'foo) -> - ([4mx[m : <m : 'a. 'a * (<m:'b. 'a * <m:'c. 'c * 'bar> > as 'bar) >);; -[mError: 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 -# [A[A[A[A[A# 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') = ([4mx[m : bar');; -[mError: 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 -# [A[A[A# - fun (x : <m : 'a. 'a * ('a * <m : 'a. 'a * 'foo> as 'foo)>) -> - ([4mx[m : <m : 'b. 'b * ('b * <m : 'c. 'c * ('c * 'bar)>)> as 'bar);; -[mError: 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 -# [A[A# fun (x : <m : 'a. 'a * ('a * <m : 'a. 'a * 'foo> as 'foo)>) -> - ([4mx[m : <m : 'b. 'b * ('b * <m : 'c. 'c * ('b * 'bar)>)> as 'bar);; -[mError: 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 -# [A[A# fun (x : <m : 'a. 'a * ('a * 'foo)> as 'foo) -> - ([4mx[m : <m : 'b. 'b * ('b * <m:'c. 'c * 'bar> as 'bar)>);; -[mError: 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 -# [A[A[A# let f x = - [4m(x : <m : 'a. 'a -> ('a * <m:'c. 'c -> 'bar> as 'bar)> - :> <m : 'a. 'a -> ('a * 'foo)> as 'foo)[m;; -[mError: 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 -# [A[A[A[A# - module M - : sig val f : (<m : 'b. 'b * ('b * <m:'c. 'c * 'bar> as 'bar)>) -> unit end - = [4mstruct let f (x : <m : 'a. 'a * ('a * 'foo)> as 'foo) = () end[m;; -[mError: 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 -# [A[A[A# module M - : sig type t = <m : 'b. 'b * ('b * <m:'c. 'c * 'bar> as 'bar)> end - = [4mstruct type t = <m : 'a. 'a * ('a * 'foo)> as 'foo end[m;; -[mError: 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> -# [A# fun x -> [4m(x : v :> u)[m;; -[mError: 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 ] -# [A# fun x -> [4m(x : u :> v)[m;; -[mError: 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> -# [A# fun x -> [4m(x : p :> q)[m;; -[mError: Type p = < x : p > is not a subtype of q = < x : p; .. > -# [A[A[A[A# - let f1 x = - [4m(x : <m:'a. (<p:int;..> as 'a) -> int> - :> <m:'b. (<p:int;q:int;..> as 'b) -> int>)[m;; -[mError: 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> -# [A[A[A# let f3 x = - [4m(x : <m:'a. (<p:<a:int;b:int>;..> as 'a) -> int> - :> <m:'b. (<p:<a:int>;..> as 'b) -> int>)[m;; -[mError: 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 > -# [A# let f4 x = [4m(x : <p:<a:int;b:int>;..> :> <p:<a:int>;..>)[m;; -[mError: 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> -# [A[A# let f6 x = - [4m(x : <m:'a. [< `A of < > ] as 'a> :> <m:'a. [< `A of <p:int> ] as 'a>)[m;; -[mError: 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> -# [A[A[A# let rec depth : 'a. 'a t -> _ = - [4mfunction Leaf _ -> 1 | Node x -> 1 + d x[m - and d x = depth x;; (* fails *) -[mError: 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 -# [A[A# let rec depth : 'a. 'a t -> _ = - [4mfunction Leaf x -> x | Node x -> 1 + depth x[m;; (* fails *) -[mError: 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 -# [A[A# let rec depth : 'a. 'a t -> _ = - [4mfunction Leaf x -> x | Node x -> depth x[m;; (* fails *) -[mError: 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 -# [A[A# let rec depth : 'a 'b. 'a t -> 'b = - [4mfunction Leaf x -> x | Node x -> depth x[m;; (* fails *) -[mError: 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 -# [A# let zero : 'a. [< `Int of int] as 'a = [4m`Int 0[m;; (* fails *) -[mError: 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} -# [A[A# type t = {f: 'a. [< `Int of int] as 'a} - let zero = {f = [4m`Int 0[m} ;; (* fails *) -[mError: 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>} -# [A# {f=[4mfun ?x y -> y[m};; (* fail *) -[mError: 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> -# [A[A# let f (x : < m : 'a. 'a -> 'a list >) = ([4mx[m : < m : 'b. 'b -> 'c >) - ;; -[mError: 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 -# [A[A[A[A[A[A# - class ['a] id1 = object - method virtual id : 'b. 'b -> 'a - method id [4mx = x[m - end - ;; -[mError: This method has type 'a -> 'a which is less general than 'b. 'b -> 'a -# [A[A[A[A[A# class id2 (x : 'a) = object - method virtual id : 'b. 'b -> 'a - method id [4mx = x[m - end - ;; -[mError: This method has type 'a -> 'a which is less general than 'b. 'b -> 'a -# [A[A[A[A[A[A# class id3 x = object - val x = x - method virtual id : 'a. 'a -> 'a - method id [4m_ = x[m - end - ;; -[mError: This method has type 'a -> 'a which is less general than 'b. 'b -> 'b -# [A[A[A[A[A[A[A[A[A# class id4 () = object - val mutable r = None - method virtual id : 'a. 'a -> 'a - method id [4mx = +# 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[m - end - ;; -[mError: 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> -# [A[A# let f3 f = f#id 1, f#id [4mtrue[m - ;; -[mError: 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) -# [A[A# type[4m 'a foo = 'a foo list[m - ;; -[mError: 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; } -# [A# let bad = {bad = [4mref None[m};; -[mError: 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} -# [A# bad2.bad2 <- [4mSome (ref None)[m;; -[mError: 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 -# [A[A[A[A[A[A# - (* various old bugs *) - class virtual ['a] visitor = - object method virtual caseNil : 'a end - and virtual int_list = - object method virtual visit : [4m'a.('a visitor -> 'a)[m end;; -[mError: 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; } -# [A[A[A# - (* PR#1663 *) - type [4mt = u[m and u = t;; -[mError: 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 ] -# [A[A[A# - (* Wrong in 3.06 *) - type ('a,'b) t constraint 'a = 'b and ('a,'b) u = [4m('a,'b) t[m;; -[mError: 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 -# [A# type 'a u = 'a and 'a v = [4m'a u t[m;; -[mError: 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 -# [A# type 'a u = 'a and 'a v = [4m'a u t[m;; -[mError: 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 -# [A[A[A# - (* Example of wrong expansion *) - type[4m 'a u = < m : 'a v >[m and 'a v = 'a list u;; -[mError: 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> -# [A# [4mfunction (`A|`B), _ -> 0 | _,(`A|`B) -> 1[m;; -[mWarning 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> -# [A# [4mfunction `B,1 -> 1 | _,1 -> 2[m;; -[mWarning 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) -[A[A[A[A# function `B,1 -> 1 | [4m_,1[m -> 2;; -[m - - +Characters 21-24: + function `B,1 -> 1 | _,1 -> 2;; + ^^^ Warning 11: this match case is unused. - : [< `B ] * int -> int = <fun> -# [A# [4mfunction 1,`B -> 1 | 1,_ -> 2[m;; -[mWarning 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, _) -[A[A[A[A# function 1,`B -> 1 | [4m1,_[m -> 2;; -[m - - +Characters 21-24: + function 1,`B -> 1 | 1,_ -> 2;; + ^^^ Warning 11: this match case is unused. - : int * [< `B ] -> int = <fun> -# [A[A[A[A# - (* pass typetexp, but fails during Typedecl.check_recursion *) - type [4m('a, 'b) a = 'a -> unit constraint 'a = [> `B of ('a, 'b) b as 'b][m - and ('a, 'b) b = 'b -> unit constraint 'b = [> `A of ('a, 'b) a as 'a];; -[mError: 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> -# [A# let f () = [4mobject method private n = 1 method m = {<>}#n end[m;; -[mWarning 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> -# [A# let f () = [4mobject (self:c) method n = 1 method m = 2 end[m;; -[mError: 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 -# [A# let f () = [4mobject (_:'s) constraint 's = < n : int > method m = 1 end[m;; -[mError: 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 -# [A[A[A[A[A# class c = object (_ : 's) - method x = 1 - method private m = - [4mobject (self: 's) method x = 3 method private m = self end[m - end;; -[mError: 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> -# [A[A[A[A[A# - - (* Unsound! *) - fun (x : <m : 'a. 'a * <m: 'b. 'a * 'foo> > as 'foo) -> - ([4mx[m : <m : 'a. 'a * (<m:'b. 'a * <m:'c. 'c * 'bar> > as 'bar) >);; -[mError: 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 -# [A[A[A[A[A# 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') = ([4mx[m : bar');; -[mError: 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 -# [A[A[A# - fun (x : <m : 'a. 'a * ('a * <m : 'a. 'a * 'foo> as 'foo)>) -> - ([4mx[m : <m : 'b. 'b * ('b * <m : 'c. 'c * ('c * 'bar)>)> as 'bar);; -[mError: 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 -# [A[A# fun (x : <m : 'a. 'a * ('a * <m : 'a. 'a * 'foo> as 'foo)>) -> - ([4mx[m : <m : 'b. 'b * ('b * <m : 'c. 'c * ('b * 'bar)>)> as 'bar);; -[mError: 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 -# [A[A# fun (x : <m : 'a. 'a * ('a * 'foo)> as 'foo) -> - ([4mx[m : <m : 'b. 'b * ('b * <m:'c. 'c * 'bar> as 'bar)>);; -[mError: 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 -# [A[A[A# let f x = - [4m(x : <m : 'a. 'a -> ('a * <m:'c. 'c -> 'bar> as 'bar)> - :> <m : 'a. 'a -> ('a * 'foo)> as 'foo)[m;; -[mError: 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 -# [A[A[A[A# - module M - : sig val f : (<m : 'b. 'b * ('b * <m:'c. 'c * 'bar> as 'bar)>) -> unit end - = [4mstruct let f (x : <m : 'a. 'a * ('a * 'foo)> as 'foo) = () end[m;; -[mError: 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 -# [A[A[A# module M - : sig type t = <m : 'b. 'b * ('b * <m:'c. 'c * 'bar> as 'bar)> end - = [4mstruct type t = <m : 'a. 'a * ('a * 'foo)> as 'foo end[m;; -[mError: 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> -# [A# fun x -> [4m(x : v :> u)[m;; -[mError: 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 ] -# [A# fun x -> [4m(x : u :> v)[m;; -[mError: 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> -# [A# fun x -> [4m(x : p :> q)[m;; -[mError: Type p = < x : p > is not a subtype of q = < x : p; .. > -# [A[A[A[A# - let f1 x = - [4m(x : <m:'a. (<p:int;..> as 'a) -> int> - :> <m:'b. (<p:int;q:int;..> as 'b) -> int>)[m;; -[mError: 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> -# [A[A[A# let f3 x = - [4m(x : <m:'a. (<p:<a:int;b:int>;..> as 'a) -> int> - :> <m:'b. (<p:<a:int>;..> as 'b) -> int>)[m;; -[mError: 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 > -# [A# let f4 x = [4m(x : <p:<a:int;b:int>;..> :> <p:<a:int>;..>)[m;; -[mError: 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> -# [A[A# let f6 x = - [4m(x : <m:'a. [< `A of < > ] as 'a> :> <m:'a. [< `A of <p:int> ] as 'a>)[m;; -[mError: 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> -# [A[A[A# let rec depth : 'a. 'a t -> _ = - [4mfunction Leaf _ -> 1 | Node x -> 1 + d x[m - and d x = depth x;; (* fails *) -[mError: 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 -# [A[A# let rec depth : 'a. 'a t -> _ = - [4mfunction Leaf x -> x | Node x -> 1 + depth x[m;; (* fails *) -[mError: 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 -# [A[A# let rec depth : 'a. 'a t -> _ = - [4mfunction Leaf x -> x | Node x -> depth x[m;; (* fails *) -[mError: 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 -# [A[A# let rec depth : 'a 'b. 'a t -> 'b = - [4mfunction Leaf x -> x | Node x -> depth x[m;; (* fails *) -[mError: 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 -# [A# let zero : 'a. [< `Int of int] as 'a = [4m`Int 0[m;; (* fails *) -[mError: 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} -# [A[A# type t = {f: 'a. [< `Int of int] as 'a} - let zero = {f = [4m`Int 0[m} ;; (* fails *) -[mError: 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>} -# [A# {f=[4mfun ?x y -> y[m};; (* fail *) -[mError: 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 -# [A[A# - let f (x : F0.t) = ([4mx[m : Foobar.t);; (* fails *) -[mError: 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 -# [A# fun (x : M1.t) -> ([4mx[m : M2.t);; (* fails *) -[mError: 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> -# [A# module M4 : sig type t = private M3.t end = [4mM2[m;; (* fails *) -[mError: 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 -# [A# module M4 : sig type t = private M3.t end = [4mM[m;; (* fails *) -[mError: 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 -# [A# module M4 : sig type t = private M3.t end = [4mM1[m;; (* might be ok *) -[mError: 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 -# [A# module M6 : sig type t = private < n:int; .. > end = [4mM1[m;; (* fails *) -[mError: 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; .. > -# [A[A[A# - module Bar : sig type t = private Foobar.t val f : int -> t end = - [4mstruct type t = int let f (x : int) = (x : t) end[m;; (* must fail *) -[mError: 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 -# [A[A[A[A[A# - module M4 : sig - type [4mt = M.t = T of int[m - val mk : int -> t - end = M;; -[mError: 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 |