Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore better printing in Base by reverting ocaml/ocaml#11515 #2029

Merged
merged 3 commits into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ocaml/testsuite/tests/generalized-open/gpr1506.ml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module M = struct
type t = B of t * t' | C
end
[%%expect{|
module M : sig type t = B of t * t/2 | C end
module M : sig type t = B of t/1 * t/2 | C end
|}]

(* test *)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
File "cannot_shadow_error.ml", line 24, characters 2-36:
24 | include Comparable with type t = t
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: Illegal shadowing of included type t/2 by t.
Error: Illegal shadowing of included type t/2 by t/1.
File "cannot_shadow_error.ml", line 23, characters 2-19:
23 | include Printable
^^^^^^^^^^^^^^^^^
Expand Down
14 changes: 7 additions & 7 deletions ocaml/testsuite/tests/shadow_include/shadow_all.ml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ end
Line 4, characters 2-11:
4 | include S
^^^^^^^^^
Error: Illegal shadowing of included type t/2 by t.
Error: Illegal shadowing of included type t/2 by t/1.
Line 2, characters 2-11:
2 | include S
^^^^^^^^^
Expand Down Expand Up @@ -144,7 +144,7 @@ end
Line 4, characters 2-11:
4 | include S
^^^^^^^^^
Error: Illegal shadowing of included module M/2 by M.
Error: Illegal shadowing of included module M/2 by M/1.
Line 2, characters 2-11:
2 | include S
^^^^^^^^^
Expand Down Expand Up @@ -189,7 +189,7 @@ end
Line 4, characters 2-11:
4 | include S
^^^^^^^^^
Error: Illegal shadowing of included module type T/2 by T.
Error: Illegal shadowing of included module type T/2 by T/1.
Line 2, characters 2-11:
2 | include S
^^^^^^^^^
Expand All @@ -210,7 +210,7 @@ end
Line 4, characters 2-11:
4 | include S
^^^^^^^^^
Error: Illegal shadowing of included type ext/2 by ext.
Error: Illegal shadowing of included type ext/2 by ext/1.
Line 2, characters 2-11:
2 | include S
^^^^^^^^^
Expand Down Expand Up @@ -506,15 +506,15 @@ end
Line 8, characters 2-8:
8 | type t
^^^^^^
Error: Illegal shadowing of included type t/4 by t.
Error: Illegal shadowing of included type t/2 by t/1.
Lines 2-5, characters 2-5:
2 | ..include struct
3 | type t = A
4 | let x = A
5 | end
Type t/4 came from this include.
Type t/2 came from this include.
Line 4, characters 8-9:
4 | let x = A
^
The value x has no valid type if t/4 is shadowed.
The value x has no valid type if t/2 is shadowed.
|}]
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ val y : (u * v * (module S)) M.t = M.X (A, B, <module>)
Line 2, characters 4-5:
2 | x = y;;
^
Error: This expression has type (u * v * (module S)) M.t
Error: This expression has type (u/1 * v/1 * (module S/1)) M/1.t
but an expression was expected of type
(u/2 * v/2 * (module S/2)) M/2.t
Hint: The types v and u have been defined multiple times in this
Expand Down Expand Up @@ -43,14 +43,16 @@ Error: This expression has type a/2 but an expression was expected of type
Line 1, characters 4-5:
1 | a = c;;
^
Error: This expression has type a but an expression was expected of type a/3
Error: This expression has type a/1 but an expression was expected of type
a/2
Hint: The type a has been defined multiple times in this toplevel
session. Some toplevel values still refer to old versions of this
type. Did you try to redefine them?
Line 1, characters 4-5:
1 | b = c;;
^
Error: This expression has type a but an expression was expected of type a/2
Error: This expression has type a/1 but an expression was expected of type
a/2
Hint: The type a has been defined multiple times in this toplevel
session. Some toplevel values still refer to old versions of this
type. Did you try to redefine them?
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ module M : sig type extension_constructor = int end
Line 2, characters 1-27:
2 | ([%extension_constructor A] : extension_constructor);;
^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: This expression has type extension_constructor/2
Error: This expression has type extension_constructor
but an expression was expected of type M.extension_constructor = int
File "_none_", line 1:
Definition of type extension_constructor/2

94 changes: 47 additions & 47 deletions ocaml/testsuite/tests/typing-misc/pr6416.ml
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ Error: Signature mismatch:
is not included in
sig val f : t -> unit end
Values do not match:
val f : t -> unit
val f : t/1 -> unit
is not included in
val f : t/2 -> unit
The type t -> unit is not compatible with the type t/2 -> unit
Type t is not compatible with type t/2
The type t/1 -> unit is not compatible with the type t/2 -> unit
Type t/1 is not compatible with type t/2
Line 6, characters 4-14:
Definition of type t
Definition of type t/1
Line 2, characters 2-12:
Definition of type t/2
|}]
Expand All @@ -49,16 +49,16 @@ Error: Signature mismatch:
is not included in
sig type u = A of t end
Type declarations do not match:
type u = A of t
type u = A of t/1
is not included in
type u = A of t/2
Constructors do not match:
A of t
A of t/1
is not the same as:
A of t
The type t is not equal to the type t/2
A of t/2
The type t/1 is not equal to the type t/2
Line 4, characters 9-19:
Definition of type t
Definition of type t/1
Line 2, characters 2-11:
Definition of type t/2
|}]
Expand All @@ -85,15 +85,15 @@ Error: Signature mismatch:
sig module A : functor (X : s) -> sig end end
In module A:
Modules do not match:
functor (X : s) -> ...
functor (X : s/1) -> ...
is not included in
functor (X : s/2) -> ...
Module types do not match:
s
s/1
does not include
s/2
Line 5, characters 6-19:
Definition of module type s
Definition of module type s/1
Line 2, characters 2-15:
Definition of module type s/2
|}]
Expand All @@ -118,16 +118,16 @@ Error: Signature mismatch:
is not included in
sig type t = A of T.t end
Type declarations do not match:
type t = A of T.t
type t = A of T/1.t
is not included in
type t = A of T/2.t
Constructors do not match:
A of T.t
A of T/1.t
is not the same as:
A of T.t
The type T.t is not equal to the type T/2.t
A of T/2.t
The type T/1.t is not equal to the type T/2.t
Line 5, characters 6-34:
Definition of module T
Definition of module T/1
Line 2, characters 2-30:
Definition of module T/2
|}]
Expand All @@ -145,22 +145,22 @@ Line 5, characters 2-62:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: Signature mismatch:
Modules do not match:
sig module type s type t = B val f : (module s) -> t/2 -> t end
sig module type s type t = B val f : (module s) -> t/2 -> t/1 end
is not included in
sig val f : (module s) -> t -> t end
Values do not match:
val f : (module s) -> t/2 -> t
val f : (module s/1) -> t/2 -> t/1
is not included in
val f : (module s/2) -> t/2 -> t/2
The type (module s) -> t/2 -> t is not compatible with the type
The type (module s/1) -> t/2 -> t/1 is not compatible with the type
(module s/2) -> t/2 -> t/2
Type (module s) is not compatible with type (module s/2)
Type (module s/1) is not compatible with type (module s/2)
Line 5, characters 23-33:
Definition of type t
Definition of type t/1
Line 3, characters 2-12:
Definition of type t/2
Line 5, characters 9-22:
Definition of module type s
Definition of module type s/1
Line 2, characters 2-15:
Definition of module type s/2
|}]
Expand All @@ -178,18 +178,18 @@ Line 5, characters 5-41:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: Signature mismatch:
Modules do not match:
sig type a = B val f : a/2 -> 'a -> a end
sig type a = B val f : a/2 -> 'a -> a/1 end
is not included in
sig val f : a -> (module a) -> a end
Values do not match:
val f : a/2 -> 'a -> a
val f : a/2 -> 'a -> a/1
is not included in
val f : a/2 -> (module a) -> a/2
The type a/2 -> (module a) -> a is not compatible with the type
The type a/2 -> (module a) -> a/1 is not compatible with the type
a/2 -> (module a) -> a/2
Type a is not compatible with type a/2
Type a/1 is not compatible with type a/2
Line 5, characters 12-22:
Definition of type a
Definition of type a/1
Line 3, characters 2-12:
Definition of type a/2
|}]
Expand Down Expand Up @@ -222,7 +222,7 @@ Error: Signature mismatch:
The public method c cannot be hidden
The first class type has no method m
Line 5, characters 4-74:
Definition of class type a
Definition of class type a/1
Line 2, characters 2-36:
Definition of class type a/2
|}]
Expand All @@ -248,12 +248,12 @@ Error: Signature mismatch:
is not included in
sig class type b = a end
Class type declarations do not match:
class type b = a
class type b = a/1
does not match
class type b = a/2
The first class type has no method m
Line 5, characters 4-29:
Definition of class type a
Definition of class type a/1
Line 2, characters 2-42:
Definition of class type a/2
|}]
Expand Down Expand Up @@ -315,11 +315,11 @@ Error: Signature mismatch:
Class type declarations do not match:
class type c = object method m : t/2 end
does not match
class type c = object method m : t end
The method m has type t/2 but is expected to have type t
Type t/2 is not equal to type t = K.t
class type c = object method m : t/1 end
The method m has type t/2 but is expected to have type t/1
Type t/2 is not equal to type t/1 = K.t
Line 12, characters 4-10:
Definition of type t
Definition of type t/1
Line 9, characters 2-8:
Definition of type t/2
|}]
Expand All @@ -338,12 +338,12 @@ Error: Signature mismatch:
is not included in
sig type t type a = M.t end
Type declarations do not match:
type a = M.t
type a = M/1.t
is not included in
type a = M/2.t
The type M.t = M/2.M.t is not equal to the type M/2.t
The type M/1.t = M/2.M.t is not equal to the type M/2.t
Line 2, characters 14-42:
Definition of module M
Definition of module M/1
File "_none_", line 1:
Definition of module M/2
|}]
Expand All @@ -368,23 +368,23 @@ Lines 5-7, characters 44-3:
7 | end..
Error: Signature mismatch:
Modules do not match:
sig val f : t/4 -> t/3 -> t/2 -> t end
sig val f : t/2 -> t/3 -> t/4 -> t/1 end
is not included in
sig val f : t -> t -> t -> t end
Values do not match:
val f : t/4 -> t/3 -> t/2 -> t
val f : t/2 -> t/3 -> t/4 -> t/1
is not included in
val f : t -> t -> t -> t
The type t/4 -> t/3 -> t/2 -> t is not compatible with the type
t -> t -> t -> t
Type t/4 is not compatible with type t
val f : t/1 -> t/1 -> t/1 -> t/1
The type t/2 -> t/3 -> t/4 -> t/1 is not compatible with the type
t/1 -> t/1 -> t/1 -> t/1
Type t/2 is not compatible with type t/1
Line 4, characters 0-10:
Definition of type t
Line 3, characters 0-10:
Definition of type t/1
Line 1, characters 0-10:
Definition of type t/2
Line 2, characters 0-10:
Definition of type t/3
Line 1, characters 0-10:
Line 3, characters 0-10:
Definition of type t/4
|}]

Expand Down
12 changes: 6 additions & 6 deletions ocaml/testsuite/tests/typing-misc/pr6634.ml
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@ Error: Signature mismatch:
Modules do not match:
sig type t = [ `T of t ] end
is not included in
sig type t = [ `T of t/2 ] end
sig type t = [ `T of t ] end
Type declarations do not match:
type t = [ `T of t ]
type t = [ `T of t/2 ]
is not included in
type t = [ `T of t/3 ]
The type [ `T of t ] is not equal to the type [ `T of t/2 ]
Type t = [ `T of t ] is not equal to type t/2 = int
type t = [ `T of t/1 ]
The type [ `T of t/1 ] is not equal to the type [ `T of t/2 ]
Type t/1 = [ `T of t/1 ] is not equal to type t/2 = int
Types for tag `T are incompatible
Line 4, characters 2-20:
Definition of type t
Definition of type t/1
Line 1, characters 0-12:
Definition of type t/2
|}]
Loading
Loading