Skip to content

Commit 6ee5b3c

Browse files
Promote test
1 parent c42d415 commit 6ee5b3c

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

ocaml/testsuite/tests/typing-layouts-or-null/variables.ml

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,7 @@ Error: This type t_value_or_null should be an instance of type ('a : value)
3636
let should_work (x : t_value_or_null) = x
3737

3838
[%%expect{|
39-
Line 1, characters 16-37:
40-
1 | let should_work (x : t_value_or_null) = x
41-
^^^^^^^^^^^^^^^^^^^^^
42-
Error: This pattern matches values of type t_value_or_null
43-
but a pattern was expected which matches values of type ('a : value)
44-
The layout of t_value_or_null is value_or_null, because
45-
of the definition of t_value_or_null at line 1, characters 0-36.
46-
But the layout of t_value_or_null must be a sublayout of value, because
47-
we must know concretely how to pass a function argument, defaulted to layout value.
39+
val should_work : t_value_or_null -> t_value_or_null = <fun>
4840
|}]
4941

5042
(* Type variables in function definitions default to [value]. *)
@@ -289,7 +281,7 @@ end
289281
[%%expect{|
290282
Lines 3-5, characters 6-3:
291283
3 | ......struct
292-
4 | let f x = x
284+
4 | let f : type a. a -> a = fun x -> x
293285
5 | end
294286
Error: Signature mismatch:
295287
Modules do not match:
@@ -302,9 +294,9 @@ Error: Signature mismatch:
302294
val f : ('a : value_or_null). 'a -> 'a
303295
The type 'a -> 'a is not compatible with the type 'b -> 'b
304296
The layout of 'a is value_or_null, because
305-
of the definition of f at line 2, characters 2-40.
297+
of the definition of f at line 2, characters 2-41.
306298
But the layout of 'a must be a sublayout of value, because
307-
of the definition of f at line 4, characters 8-13.
299+
of the definition of f at line 4, characters 6-7.
308300
|}]
309301

310302
(* CR layouts v3.0: annotations on non-rigid type variables are upper bounds.

0 commit comments

Comments
 (0)