summaryrefslogtreecommitdiff
path: root/testsuite/tests/typing-extensions
diff options
context:
space:
mode:
authorArmaël Guéneau <armael.gueneau@ens-lyon.fr>2018-10-08 16:33:17 +0200
committerArmaël Guéneau <armael.gueneau@ens-lyon.fr>2018-10-19 23:38:25 +0200
commit48f806a66261704c2e563277fa66af2cd32ea568 (patch)
tree05830e2dd6cd192be0da13bc08b8b6a249708389 /testsuite/tests/typing-extensions
parentf954160614f348bb81b43b751889cbfb99e06f48 (diff)
downloadocaml-48f806a66261704c2e563277fa66af2cd32ea568.tar.gz
Update tests
Diffstat (limited to 'testsuite/tests/typing-extensions')
-rw-r--r--testsuite/tests/typing-extensions/extensions.ocaml.reference52
-rw-r--r--testsuite/tests/typing-extensions/open_types.ocaml.reference52
2 files changed, 52 insertions, 52 deletions
diff --git a/testsuite/tests/typing-extensions/extensions.ocaml.reference b/testsuite/tests/typing-extensions/extensions.ocaml.reference
index b7c1bf9a29..53e3060000 100644
--- a/testsuite/tests/typing-extensions/extensions.ocaml.reference
+++ b/testsuite/tests/typing-extensions/extensions.ocaml.reference
@@ -4,24 +4,24 @@ type foo += A | B of int
val is_a : foo -> bool = <fun>
type foo
Line 2, characters 0-20:
- type foo += A of int (* Error type is not open *)
- ^^^^^^^^^^^^^^^^^^^^
+2 | type foo += A of int (* Error type is not open *)
+ ^^^^^^^^^^^^^^^^^^^^
Error: Type definition foo is not extensible
type foo = private ..
Line 2, characters 12-20:
- type foo += A of int (* Error type is private *)
- ^^^^^^^^
+2 | type foo += A of int (* Error type is private *)
+ ^^^^^^^^
Error: Cannot extend private type definition foo
type 'a foo = ..
Line 2, characters 0-29:
- type ('a, 'b) foo += A of int (* Error: type parameter mismatch *)
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+2 | type ('a, 'b) foo += A of int (* Error: type parameter mismatch *)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: This extension does not match the definition of type foo
They have different arities.
module type S = sig type foo = private .. type foo += A of float end
Line 7, characters 2-24:
- type foo += B of float (* Error: foo does not have an extensible type *)
- ^^^^^^^^^^^^^^^^^^^^^^
+7 | type foo += B of float (* Error: foo does not have an extensible type *)
+ ^^^^^^^^^^^^^^^^^^^^^^
Error: Type definition foo is not extensible
type foo = ..
module M :
@@ -43,13 +43,13 @@ val get_num : 'a foo -> 'a -> 'a option = <fun>
type 'a foo = .. constraint 'a = [> `Var ]
type 'a foo += A of 'a
Line 2, characters 10-11:
- let a = A 9 (* ERROR: Constraints not met *)
- ^
+2 | let a = A 9 (* ERROR: Constraints not met *)
+ ^
Error: This expression has type int but an expression was expected of type
[> `Var ]
Line 2, characters 19-22:
- type 'a foo += B : int foo (* ERROR: Constraints not met *)
- ^^^
+2 | type 'a foo += B : int foo (* ERROR: Constraints not met *)
+ ^^^
Error: This type int should be an instance of type [> `Var ]
type foo = ..
module M : sig type foo += A of int end
@@ -58,26 +58,26 @@ module type S = sig type foo += private A of int end
module M_S : S
val is_s : foo -> bool = <fun>
Line 2, characters 9-17:
- let a2 = M_S.A 20 (* ERROR: Cannot create a value using a private constructor *)
- ^^^^^^^^
+2 | let a2 = M_S.A 20 (* ERROR: Cannot create a value using a private constructor *)
+ ^^^^^^^^
Error: Cannot create values of the private type foo
type foo = ..
module M : sig type foo += A1 of int end
type foo += A2 of int
type bar = ..
Line 2, characters 17-21:
- type bar += A3 = M.A1 (* Error: rebind wrong type *)
- ^^^^
+2 | type bar += A3 = M.A1 (* Error: rebind wrong type *)
+ ^^^^
Error: The constructor M.A1 has type foo but was expected to be of type bar
module M : sig type foo += private B1 of int end
type foo += private B2 of int
Line 2, characters 17-21:
- type foo += B3 = M.B1 (* Error: rebind private extension *)
- ^^^^
+2 | type foo += B3 = M.B1 (* Error: rebind private extension *)
+ ^^^^
Error: The constructor M.B1 is private
Line 2, characters 16-23:
- type foo += C = Unknown (* Error: unbound extension *)
- ^^^^^^^
+2 | type foo += C = Unknown (* Error: unbound extension *)
+ ^^^^^^^
Error: Unbound constructor Unknown
module M : sig type foo = private .. type foo += A1 of int end
type M.foo += A2 of int
@@ -89,21 +89,21 @@ type 'a foo2 += D of int | E of 'a | F : int foo2
type +'a foo = ..
type 'a foo += A of (int -> 'a)
Line 2, characters 0-31:
- type 'a foo += B of ('a -> int)
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+2 | type 'a foo += B of ('a -> int)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: In this definition, expected parameter variances are not satisfied.
The 1st type parameter was expected to be covariant,
but it is injective contravariant.
Line 2, characters 0-39:
- type _ foo += C : ('a -> int) -> 'a foo
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+2 | type _ foo += C : ('a -> int) -> 'a foo
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: In this definition, expected parameter variances are not satisfied.
The 1st type parameter was expected to be covariant,
but it is injective contravariant.
type 'a bar = ..
Line 2, characters 0-32:
- type +'a bar += D of (int -> 'a) (* ERROR: type variances do not match *)
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+2 | type +'a bar += D of (int -> 'a) (* ERROR: type variances do not match *)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: This extension does not match the definition of type bar
Their variances do not agree.
module M : sig type exn += Foo of int * float | Bar : 'a list -> exn end
diff --git a/testsuite/tests/typing-extensions/open_types.ocaml.reference b/testsuite/tests/typing-extensions/open_types.ocaml.reference
index 3d0e0bec0e..2c8650af00 100644
--- a/testsuite/tests/typing-extensions/open_types.ocaml.reference
+++ b/testsuite/tests/typing-extensions/open_types.ocaml.reference
@@ -9,24 +9,24 @@ module M_S : S
type foo = ..
type bar = foo
Line 2, characters 0-22:
- type bar += Bar of int (* Error: type is not open *)
- ^^^^^^^^^^^^^^^^^^^^^^
+2 | type bar += Bar of int (* Error: type is not open *)
+ ^^^^^^^^^^^^^^^^^^^^^^
Error: Type definition bar is not extensible
Line 2, characters 0-19:
- type baz = bar = .. (* Error: type kinds don't match *)
- ^^^^^^^^^^^^^^^^^^^
+2 | type baz = bar = .. (* Error: type kinds don't match *)
+ ^^^^^^^^^^^^^^^^^^^
Error: This variant or record definition does not match that of type bar
Their kinds differ.
type 'a foo = ..
Line 2, characters 0-31:
- type ('a, 'b) bar = 'a foo = .. (* Error: arrities do not match *)
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+2 | type ('a, 'b) bar = 'a foo = .. (* Error: arrities do not match *)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: This variant or record definition does not match that of type 'a foo
They have different arities.
type ('a, 'b) foo = ..
Line 2, characters 0-37:
- type ('a, 'b) bar = ('a, 'a) foo = .. (* Error: constraints do not match *)
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+2 | type ('a, 'b) bar = ('a, 'a) foo = .. (* Error: constraints do not match *)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: This variant or record definition does not match that of type
('a, 'a) foo
Their constraints differ.
@@ -34,14 +34,14 @@ module M : sig type foo = .. end
module type S = sig type foo end
module M_S : S
Line 2, characters 0-19:
- type M_S.foo += Foo (* ERROR: Cannot extend a type that isn't "open" *)
- ^^^^^^^^^^^^^^^^^^^
+2 | type M_S.foo += Foo (* ERROR: Cannot extend a type that isn't "open" *)
+ ^^^^^^^^^^^^^^^^^^^
Error: Type definition M_S.foo is not extensible
module M : sig type foo end
module type S = sig type foo = .. end
Line 2, characters 14-15:
- module M_S = (M : S) (* ERROR: Signatures are not compatible *)
- ^
+2 | module M_S = (M : S) (* ERROR: Signatures are not compatible *)
+ ^
Error: Signature mismatch:
Modules do not match: sig type foo = M.foo end is not included in S
Type declarations do not match:
@@ -53,14 +53,14 @@ module M : sig type foo = .. end
module type S = sig type foo = private .. end
module M_S : S
Line 2, characters 16-19:
- type M_S.foo += Foo (* ERROR: Cannot extend a private extensible type *)
- ^^^
+2 | type M_S.foo += Foo (* ERROR: Cannot extend a private extensible type *)
+ ^^^
Error: Cannot extend private type definition M_S.foo
module M : sig type foo = private .. end
module type S = sig type foo = .. end
Line 2, characters 14-15:
- module M_S = (M : S) (* ERROR: Signatures are not compatible *)
- ^
+2 | module M_S = (M : S) (* ERROR: Signatures are not compatible *)
+ ^
Error: Signature mismatch:
Modules do not match:
sig type foo = M.foo = private .. end
@@ -74,8 +74,8 @@ Error: Signature mismatch:
module M : sig type +'a foo = .. type 'a bar = 'a foo = .. end
module type S = sig type 'a foo = .. type 'a bar = 'a foo = .. end
Line 2, characters 14-15:
- module M_S = (M : S) (* ERROR: Signatures are not compatible *)
- ^
+2 | module M_S = (M : S) (* ERROR: Signatures are not compatible *)
+ ^
Error: Signature mismatch:
Modules do not match:
sig type 'a foo = 'a M.foo = .. type 'a bar = 'a foo = .. end
@@ -88,8 +88,8 @@ Error: Signature mismatch:
Their variances do not agree.
type exn2 = exn = ..
Line 6, characters 8-26:
- let f = function Foo -> ()
- ^^^^^^^^^^^^^^^^^^
+6 | let f = function Foo -> ()
+ ^^^^^^^^^^^^^^^^^^
Warning 8: this pattern-matching is not exhaustive.
Here is an example of a case that is not matched:
*extension*
@@ -99,10 +99,10 @@ type foo = ..
type foo += Foo
val f : foo -> unit = <fun>
Line 4, characters 8-60:
- ........function
- | [Foo] -> 1
- | _::_::_ -> 3
- | [] -> 2
+4 | ........function
+ | | [Foo] -> 1
+ | | _::_::_ -> 3
+7 | | [] -> 2
Warning 8: this pattern-matching is not exhaustive.
Here is an example of a case that is not matched:
*extension*::[]
@@ -112,8 +112,8 @@ val f : foo list -> int = <fun>
type t = ..
type t += IPair : (int * int) -> t
Line 2, characters 8-62:
- let f = function IPair (i, j) -> Format.sprintf "(%d, %d)" i j ;; (* warn *)
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+2 | let f = function IPair (i, j) -> Format.sprintf "(%d, %d)" i j ;; (* warn *)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Warning 8: this pattern-matching is not exhaustive.
Here is an example of a case that is not matched:
*extension*