Skip to content

Commit 65754bb

Browse files
accept tests
1 parent 43406b2 commit 65754bb

File tree

15 files changed

+71
-40
lines changed

15 files changed

+71
-40
lines changed

testsuite/tests/lib-array/test_iarray.ml

+14
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,20 @@ let rec list_map_local_input (local_ f) (local_ list) =
3232
module Iarray = Stdlib_stable.Iarray
3333
external ( .:() ) : 'a iarray -> int -> 'a = "%array_safe_get"
3434
val iarray : int iarray = [:1; 2; 3; 4; 5:]
35+
val iarray_local : unit -> local_ int iarray @ unyielding = <fun>
36+
val ifarray : float iarray = [:1.5; 2.5; 3.5; 4.5; 5.5:]
37+
val ifarray_local : unit -> local_ float iarray @ unyielding = <fun>
38+
val marray : int array = [|1; 2; 3; 4; 5|]
39+
val mfarray : float array = [|1.5; 2.5; 3.5; 4.5; 5.5|]
40+
external globalize_float : local_ float -> float = "%obj_dup"
41+
external globalize_string : local_ string -> string = "%obj_dup"
42+
val globalize_int_iarray : local_ int iarray -> int iarray = <fun>
43+
val list_map_local_input :
44+
local_ (local_ 'a -> 'b) -> local_ 'a list -> 'b list = <fun>
45+
|}, Principal{|
46+
module Iarray = Stdlib_stable.Iarray
47+
external ( .:() ) : 'a iarray -> int -> 'a = "%array_safe_get"
48+
val iarray : int iarray = [:1; 2; 3; 4; 5:]
3549
val iarray_local : unit -> local_ int iarray = <fun>
3650
val ifarray : float iarray = [:1.5; 2.5; 3.5; 4.5; 5.5:]
3751
val ifarray_local : unit -> local_ float iarray = <fun>

testsuite/tests/typing-jkind-bounds/basics.ml

+7-7
Original file line numberDiff line numberDiff line change
@@ -1149,7 +1149,7 @@ Error: The kind of type "t" is value
11491149
because it instantiates an unannotated type parameter of t,
11501150
chosen to have kind value.
11511151
But the kind of type "t" must be a subkind of
1152-
immutable_data mod global aliased
1152+
immutable_data mod global yielding aliased
11531153
because of the annotation on the declaration of the type t.
11541154
|}]
11551155
(* CR layouts v2.8: this should be accepted *)
@@ -1164,7 +1164,7 @@ Error: The kind of type "t" is value
11641164
because it instantiates an unannotated type parameter of t,
11651165
chosen to have kind value.
11661166
But the kind of type "t" must be a subkind of
1167-
immutable_data mod global aliased
1167+
immutable_data mod global yielding aliased
11681168
because of the annotation on the declaration of the type t.
11691169
|}]
11701170
(* CR layouts v2.8: this should be accepted *)
@@ -1245,7 +1245,7 @@ type 'a t : value mod global = { x : 'a @@ global }
12451245
Line 1, characters 0-51:
12461246
1 | type 'a t : value mod global = { x : 'a @@ global }
12471247
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1248-
Error: The kind of type "t" is value
1248+
Error: The kind of type "t" is value mod unyielding
12491249
because it's a boxed record type.
12501250
But the kind of type "t" must be a subkind of value mod global
12511251
because of the annotation on the declaration of the type t.
@@ -1424,7 +1424,7 @@ Line 1, characters 41-51:
14241424
^^^^^^^^^^
14251425
Error: This expression has type "< >" but an expression was expected of type
14261426
"('a : value mod aliased)"
1427-
The kind of < > is value mod global many unyielding
1427+
The kind of < > is value mod global many
14281428
because it's the type of an object.
14291429
But the kind of < > must be a subkind of value mod aliased
14301430
because of the annotation on the wildcard _ at line 1, characters 19-36.
@@ -1437,7 +1437,7 @@ Line 1, characters 42-52:
14371437
^^^^^^^^^^
14381438
Error: This expression has type "< >" but an expression was expected of type
14391439
"('a : value mod portable)"
1440-
The kind of < > is value mod global many unyielding
1440+
The kind of < > is value mod global many
14411441
because it's the type of an object.
14421442
But the kind of < > must be a subkind of value mod portable
14431443
because of the annotation on the wildcard _ at line 1, characters 19-37.
@@ -1450,7 +1450,7 @@ Line 1, characters 43-53:
14501450
^^^^^^^^^^
14511451
Error: This expression has type "< >" but an expression was expected of type
14521452
"('a : value mod contended)"
1453-
The kind of < > is value mod global many unyielding
1453+
The kind of < > is value mod global many
14541454
because it's the type of an object.
14551455
But the kind of < > must be a subkind of value mod contended
14561456
because of the annotation on the wildcard _ at line 1, characters 19-38.
@@ -1463,7 +1463,7 @@ Line 1, characters 43-53:
14631463
^^^^^^^^^^
14641464
Error: This expression has type "< >" but an expression was expected of type
14651465
"('a : value mod external_)"
1466-
The kind of < > is value mod global many unyielding
1466+
The kind of < > is value mod global many
14671467
because it's the type of an object.
14681468
But the kind of < > must be a subkind of value mod external_
14691469
because of the annotation on the wildcard _ at line 1, characters 19-38.

testsuite/tests/typing-jkind-bounds/printing.ml

+8-8
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ Line 3, characters 11-12:
164164
^
165165
Error: This type "a" = "int ref" should be an instance of type
166166
"('a : immutable_data)"
167-
The kind of a is mutable_data with int @@ many.
167+
The kind of a is mutable_data with int @@ unyielding many.
168168
But the kind of a must be a subkind of immutable_data
169169
because of the definition of t at line 2, characters 0-28.
170170

@@ -178,7 +178,7 @@ Line 3, characters 11-12:
178178
^
179179
Error: This type "a" = "int ref" should be an instance of type
180180
"('a : immutable_data)"
181-
The kind of a is mutable_data with int @@ many.
181+
The kind of a is mutable_data with int @@ unyielding many.
182182
But the kind of a must be a subkind of immutable_data
183183
because of the definition of t at line 2, characters 0-28.
184184

@@ -343,15 +343,15 @@ Error: Signature mismatch:
343343
Modules do not match:
344344
sig type 'a t : mutable_data with 'a end
345345
is not included in
346-
sig type 'a t : mutable_data with 'a @@ many end
346+
sig type 'a t : mutable_data with 'a @@ unyielding many end
347347
Type declarations do not match:
348348
type 'a t : mutable_data with 'a
349349
is not included in
350-
type 'a t : mutable_data with 'a @@ many
350+
type 'a t : mutable_data with 'a @@ unyielding many
351351
The kind of the first is mutable_data with 'a
352352
because of the definition of t at line 4, characters 2-34.
353353
But the kind of the first must be a subkind of mutable_data
354-
with 'a @@ many
354+
with 'a @@ unyielding many
355355
because of the definition of t at line 2, characters 2-40.
356356

357357
The first mode-crosses less than the second along:
@@ -423,14 +423,14 @@ Lines 3-5, characters 6-3:
423423
5 | end
424424
Error: Signature mismatch:
425425
Modules do not match:
426-
sig type 'a t : mutable_data with 'a @@ many end
426+
sig type 'a t : mutable_data with 'a @@ unyielding many end
427427
is not included in
428428
sig type 'a t : immutable_data with 'a end
429429
Type declarations do not match:
430-
type 'a t : mutable_data with 'a @@ many
430+
type 'a t : mutable_data with 'a @@ unyielding many
431431
is not included in
432432
type 'a t : immutable_data with 'a
433-
The kind of the first is mutable_data with 'a @@ many
433+
The kind of the first is mutable_data with 'a @@ unyielding many
434434
because of the definition of t at line 4, characters 2-40.
435435
But the kind of the first must be a subkind of immutable_data with 'a
436436
because of the definition of t at line 2, characters 2-56.

testsuite/tests/typing-jkind-bounds/records.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ type ('a : value mod global) t : value mod global = { x : 'a }
206206
Line 1, characters 0-62:
207207
1 | type ('a : value mod global) t : value mod global = { x : 'a }
208208
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
209-
Error: The kind of type "t" is value
209+
Error: The kind of type "t" is value mod unyielding
210210
because it's a boxed record type.
211211
But the kind of type "t" must be a subkind of value mod global
212212
because of the annotation on the declaration of the type t.

testsuite/tests/typing-jkind-bounds/subsumption/basics.ml

+4-4
Original file line numberDiff line numberDiff line change
@@ -176,15 +176,15 @@ Error: Signature mismatch:
176176
Modules do not match:
177177
sig type 'a t : mutable_data with 'a end
178178
is not included in
179-
sig type 'a t : mutable_data with 'a @@ many end
179+
sig type 'a t : mutable_data with 'a @@ unyielding many end
180180
Type declarations do not match:
181181
type 'a t : mutable_data with 'a
182182
is not included in
183-
type 'a t : mutable_data with 'a @@ many
183+
type 'a t : mutable_data with 'a @@ unyielding many
184184
The kind of the first is mutable_data with 'a
185185
because of the definition of t at line 4, characters 2-34.
186186
But the kind of the first must be a subkind of mutable_data
187-
with 'a @@ many
187+
with 'a @@ unyielding many
188188
because of the definition of t at line 2, characters 2-40.
189189

190190
The first mode-crosses less than the second along:
@@ -198,7 +198,7 @@ end = struct
198198
type 'a t : mutable_data with 'a @@ many unyielding
199199
end
200200
[%%expect {|
201-
module M : sig type 'a t : mutable_data with 'a @@ many end
201+
module M : sig type 'a t : mutable_data with 'a @@ unyielding many end
202202
|}]
203203

204204
(* CR layouts v2.8: 'a u's kind should get normalized to just immutable_data *)

testsuite/tests/typing-jkind-bounds/subsumption/constraint.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ Error: Signature mismatch:
145145
type 'a t = Foo of 'a constraint 'a = 'b ref
146146
is not included in
147147
type 'a t : immutable_data with 'b constraint 'a = 'b ref
148-
The kind of the first is mutable_data with 'b @@ many
148+
The kind of the first is mutable_data with 'b @@ unyielding many
149149
because of the definition of t at line 4, characters 2-46.
150150
But the kind of the first must be a subkind of immutable_data with 'b
151151
because of the definition of t at line 2, characters 2-59.

testsuite/tests/typing-jkind-bounds/subsumption/functors.ml

+2-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ module Ref : sig type 'a t = 'a ref end
5858
Line 4, characters 0-48:
5959
4 | type 'a t : immutable_data with 'a = 'a F(Ref).t
6060
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
61-
Error: The kind of type "'a F(Ref).t" is mutable_data with 'a @@ many
61+
Error: The kind of type "'a F(Ref).t" is mutable_data
62+
with 'a @@ unyielding many
6263
because of the definition of t at line 2, characters 2-40.
6364
But the kind of type "'a F(Ref).t" must be a subkind of immutable_data
6465
with 'a

testsuite/tests/typing-jkind-bounds/subsumption/modalities.ml

+1-2
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,7 @@ end = struct
124124
type 'a t : immediate with 'a @@ aliased many contended global portable
125125
end
126126
[%%expect {|
127-
module M :
128-
sig type 'a t : value mod global aliased many contended portable end
127+
module M : sig type 'a t : immutable_data mod global yielding aliased end
129128
|}]
130129

131130
module M : sig

testsuite/tests/typing-jkind-bounds/variants.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ type ('a : value mod global) t : value mod global = Foo of 'a
210210
Line 1, characters 0-61:
211211
1 | type ('a : value mod global) t : value mod global = Foo of 'a
212212
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
213-
Error: The kind of type "t" is value
213+
Error: The kind of type "t" is value mod unyielding
214214
because it's a boxed variant type.
215215
But the kind of type "t" must be a subkind of value mod global
216216
because of the annotation on the declaration of the type t.

testsuite/tests/typing-layouts/allow_any.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ module B = struct
313313
let a t = t.a
314314
end
315315
[%%expect{|
316-
module A : sig type t : mutable_data mod global external_ end
316+
module A : sig type t : mutable_data mod global yielding external_ end
317317
module B :
318318
sig
319319
type t : value mod contended portable = { a : A.t; }

testsuite/tests/typing-local/exclave.ml

+4-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ let foo () =
1919
let local_ y = Some 42 in
2020
y
2121
[%%expect{|
22-
val foo : unit -> local_ int option = <fun>
22+
val foo : unit -> local_ int option @ unyielding = <fun>
2323
|}]
2424
(* sidenote: in the above,
2525
y escapes the function even though local_
@@ -140,6 +140,9 @@ let foo (local_ x) =
140140

141141
[%%expect{|
142142
type t = { x : int option; }
143+
val foo : local_ int option -> local_ int option @ unyielding = <fun>
144+
|}, Principal{|
145+
type t = { x : int option; }
143146
val foo : local_ int option -> local_ int option = <fun>
144147
|}]
145148

testsuite/tests/typing-local/local.ml

+13-9
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,9 @@ val foo : ?x:local_ 'a -> unit -> local_ 'a option = <fun>
378378

379379
let foo ?(local_ x = "hello") () = x;;
380380
[%%expect{|
381-
val foo : ?x:local_ string -> unit -> local_ string @ unyielding = <fun>
381+
val foo :
382+
?x:local_ string -> local_
383+
(unit -> local_ string @ unyielding) @ unyielding = <fun>
382384
|}, Principal{|
383385
val foo : ?x:local_ string -> unit -> local_ string = <fun>
384386
|}]
@@ -966,15 +968,15 @@ let foo x = exclave_
966968
let r = local_ { contents = x } in
967969
r
968970
[%%expect{|
969-
val foo : 'a -> local_ 'a ref = <fun>
971+
val foo : 'a -> local_ 'a ref @ unyielding = <fun>
970972
|}]
971973

972974
let foo p x = exclave_
973975
let r = local_ { contents = x } in
974976
if p then r
975977
else r
976978
[%%expect{|
977-
val foo : bool -> 'a -> local_ 'a ref = <fun>
979+
val foo : bool -> 'a -> local_ 'a ref @ unyielding = <fun>
978980
|}]
979981

980982
(* Non-local regional values can be passed to tail calls *)
@@ -1768,7 +1770,7 @@ let testbool1 f = let local_ r = ref 42 in (f r || false) && true
17681770

17691771
let testbool2 f = let local_ r = ref 42 in true && (false || f r)
17701772
[%%expect{|
1771-
val testbool1 : (local_ int ref -> bool) -> bool = <fun>
1773+
val testbool1 : (local_ int ref @ unyielding -> bool) -> bool = <fun>
17721774
Line 3, characters 63-64:
17731775
3 | let testbool2 f = let local_ r = ref 42 in true && (false || f r)
17741776
^
@@ -1855,14 +1857,15 @@ let f g n =
18551857
()
18561858
let z : (int list -> unit) -> int -> unit = f
18571859
[%%expect{|
1858-
val f : (local_ int list -> unit) -> int -> unit = <fun>
1860+
val f : (local_ int list @ unyielding -> unit) -> int -> unit = <fun>
18591861
Line 5, characters 44-45:
18601862
5 | let z : (int list -> unit) -> int -> unit = f
18611863
^
1862-
Error: This expression has type "(local_ int list -> unit) -> int -> unit"
1864+
Error: This expression has type
1865+
"(local_ int list @ unyielding -> unit) -> int -> unit"
18631866
but an expression was expected of type
18641867
"(int list -> unit) -> int -> unit"
1865-
Type "local_ int list -> unit" is not compatible with type
1868+
Type "local_ int list @ unyielding -> unit" is not compatible with type
18661869
"int list -> unit"
18671870
|}]
18681871

@@ -1877,10 +1880,11 @@ end
18771880
Line 6, characters 46-47:
18781881
6 | let z : (int list -> unit) -> int -> unit = f
18791882
^
1880-
Error: This expression has type "(local_ int list -> unit) -> int -> unit"
1883+
Error: This expression has type
1884+
"(local_ int list @ unyielding -> unit) -> int -> unit"
18811885
but an expression was expected of type
18821886
"(int list -> unit) -> int -> unit"
1883-
Type "local_ int list -> unit" is not compatible with type
1887+
Type "local_ int list @ unyielding -> unit" is not compatible with type
18841888
"int list -> unit"
18851889
|}]
18861890

testsuite/tests/typing-modes/modes.ml

+9-1
Original file line numberDiff line numberDiff line change
@@ -392,13 +392,21 @@ type r = { mutable x : string; }
392392

393393
(* patterns *)
394394

395-
let foo ?(local_ x @ unique once = 42) () = ()
395+
let foo ?(x @ local unique once = 42) () = ()
396396
[%%expect{|
397+
val foo :
398+
?x:local_ int @ once unique -> local_ (unit -> unit) @ once unyielding =
399+
<fun>
400+
|}, Principal{|
397401
val foo : ?x:local_ int @ once unique -> unit -> unit = <fun>
398402
|}]
399403

400404
let foo ?(local_ x : _ @@ unique once = 42) () = ()
401405
[%%expect{|
406+
val foo :
407+
?x:local_ int @ once unique -> local_ (unit -> unit) @ once unyielding =
408+
<fun>
409+
|}, Principal{|
402410
val foo : ?x:local_ int @ once unique -> unit -> unit = <fun>
403411
|}]
404412

testsuite/tests/typing-modes/yielding.ml

+3-3
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,8 @@ type w2 : value mod global unyielding
155155

156156
[%%expect{|
157157
type ('a : value mod global) u1
158-
type ('a : value mod global) u2
159-
type w1 : value mod global
158+
type ('a : value mod global yielding) u2
159+
type w1 : value mod global yielding
160160
type w2 : value mod global
161161
|}]
162162

@@ -167,7 +167,7 @@ Line 1, characters 11-13:
167167
1 | type _z1 = w1 u1
168168
^^
169169
Error: This type "w1" should be an instance of type "('a : value mod global)"
170-
The kind of w1 is value mod global
170+
The kind of w1 is value mod global yielding
171171
because of the definition of w1 at line 5, characters 0-35.
172172
But the kind of w1 must be a subkind of value mod global
173173
because of the definition of u1 at line 1, characters 0-31.

testsuite/tests/typing-unique/unique.ml

+2
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,8 @@ let rec bar =
385385
| Some () -> ()
386386
| None -> bar (local_ Some ()) [@nontail]
387387
[%%expect{|
388+
val bar : local_ unit option @ unique unyielding -> unit = <fun>
389+
|}, Principal{|
388390
val bar : local_ unit option @ unique -> unit = <fun>
389391
|}]
390392

0 commit comments

Comments
 (0)