Skip to content

Commit f15cd33

Browse files
authored
Modality.Value.Const should behave like a product (#3961)
1 parent 3a8999d commit f15cd33

File tree

23 files changed

+360
-330
lines changed

23 files changed

+360
-330
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -990,7 +990,7 @@ type ('a : immediate) t : value mod global = { mutable x : 'a }
990990
Line 1, characters 0-63:
991991
1 | type ('a : immediate) t : value mod global = { mutable x : 'a }
992992
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
993-
Error: The kind of type "t" is mutable_data with 'a @@ many unyielding
993+
Error: The kind of type "t" is mutable_data with 'a @@ unyielding many
994994
because it's a boxed record type.
995995
But the kind of type "t" must be a subkind of value mod global
996996
because of the annotation on the declaration of the type t.
@@ -1004,7 +1004,7 @@ type ('a : immediate) t : value mod aliased = { mutable x : 'a }
10041004
Line 1, characters 0-64:
10051005
1 | type ('a : immediate) t : value mod aliased = { mutable x : 'a }
10061006
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1007-
Error: The kind of type "t" is mutable_data with 'a @@ many unyielding
1007+
Error: The kind of type "t" is mutable_data with 'a @@ unyielding many
10081008
because it's a boxed record type.
10091009
But the kind of type "t" must be a subkind of value mod aliased
10101010
because of the annotation on the declaration of the type t.
@@ -1018,7 +1018,7 @@ type ('a : immediate) t : value mod contended = { mutable x : 'a }
10181018
Line 1, characters 0-66:
10191019
1 | type ('a : immediate) t : value mod contended = { mutable x : 'a }
10201020
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1021-
Error: The kind of type "t" is mutable_data with 'a @@ many unyielding
1021+
Error: The kind of type "t" is mutable_data with 'a @@ unyielding many
10221022
because it's a boxed record type.
10231023
But the kind of type "t" must be a subkind of value mod contended
10241024
because of the annotation on the declaration of the type t.
@@ -1032,7 +1032,7 @@ type ('a : immediate) t : value mod external_ = { mutable x : 'a }
10321032
Line 1, characters 0-66:
10331033
1 | type ('a : immediate) t : value mod external_ = { mutable x : 'a }
10341034
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1035-
Error: The kind of type "t" is mutable_data with 'a @@ many unyielding
1035+
Error: The kind of type "t" is mutable_data with 'a @@ unyielding many
10361036
because it's a boxed record type.
10371037
But the kind of type "t" must be a subkind of value mod external_
10381038
because of the annotation on the declaration of the type t.
@@ -1046,7 +1046,7 @@ type ('a : immediate) t : value mod external64 = { mutable x : 'a }
10461046
Line 1, characters 0-67:
10471047
1 | type ('a : immediate) t : value mod external64 = { mutable x : 'a }
10481048
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1049-
Error: The kind of type "t" is mutable_data with 'a @@ many unyielding
1049+
Error: The kind of type "t" is mutable_data with 'a @@ unyielding many
10501050
because it's a boxed record type.
10511051
But the kind of type "t" must be a subkind of value mod external64
10521052
because of the annotation on the declaration of the type t.

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ Line 1, characters 13-20:
189189
1 | let foo (t : int ref t @ contended) = use_uncontended t
190190
^^^^^^^
191191
Error: This type "int ref" should be an instance of type "('a : immutable_data)"
192-
The kind of int ref is mutable_data with int @@ many unyielding.
192+
The kind of int ref is mutable_data with int @@ unyielding many.
193193
But the kind of int ref must be a subkind of immutable_data
194194
because of the definition of t at line 1, characters 0-46.
195195

@@ -341,7 +341,7 @@ Line 1, characters 13-20:
341341
1 | let foo (t : int ref t @ contended) = use_uncontended t
342342
^^^^^^^
343343
Error: This type "int ref" should be an instance of type "('a : immutable_data)"
344-
The kind of int ref is mutable_data with int @@ many unyielding.
344+
The kind of int ref is mutable_data with int @@ unyielding many.
345345
But the kind of int ref must be a subkind of immutable_data
346346
because of the definition of t at line 1, characters 0-73.
347347

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ type 'a t : mutable_data = 'a ref
176176
Line 1, characters 0-33:
177177
1 | type 'a t : mutable_data = 'a ref
178178
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
179-
Error: The kind of type "'a ref" is mutable_data with 'a @@ many unyielding.
179+
Error: The kind of type "'a ref" is mutable_data with 'a @@ unyielding many.
180180
But the kind of type "'a ref" must be a subkind of mutable_data
181181
because of the definition of t at line 1, characters 0-33.
182182

@@ -199,7 +199,7 @@ Line 1, characters 14-21:
199199
^^^^^^^
200200
Error: This type "int ref" should be an instance of type
201201
"('a : value mod portable)"
202-
The kind of int ref is mutable_data with int @@ many unyielding.
202+
The kind of int ref is mutable_data with int @@ unyielding many.
203203
But the kind of int ref must be a subkind of value mod portable
204204
because of the definition of require_portable at line 10, characters 0-47.
205205

@@ -223,7 +223,7 @@ Line 1, characters 14-21:
223223
^^^^^^^
224224
Error: This type "int ref" should be an instance of type
225225
"('a : value mod contended)"
226-
The kind of int ref is mutable_data with int @@ many unyielding.
226+
The kind of int ref is mutable_data with int @@ unyielding many.
227227
But the kind of int ref must be a subkind of value mod contended
228228
because of the definition of require_contended at line 9, characters 0-49.
229229

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ Line 3, characters 11-12:
179179
^
180180
Error: This type "a" = "int ref" should be an instance of type
181181
"('a : immutable_data)"
182-
The kind of a is mutable_data with int @@ many unyielding.
182+
The kind of a is mutable_data with int @@ unyielding many.
183183
But the kind of a must be a subkind of immutable_data
184184
because of the definition of t at line 2, characters 0-28.
185185

@@ -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 unyielding 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 unyielding
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 unyielding
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 unyielding 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 unyielding
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 unyielding
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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ type 'a t : immutable_data = { mutable x : 'a }
128128
Line 1, characters 0-47:
129129
1 | type 'a t : immutable_data = { mutable x : 'a }
130130
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
131-
Error: The kind of type "t" is mutable_data with 'a @@ many unyielding
131+
Error: The kind of type "t" is mutable_data with 'a @@ unyielding many
132132
because it's a boxed record type.
133133
But the kind of type "t" must be a subkind of immutable_data
134134
because of the annotation on the declaration of the type t.
@@ -270,7 +270,7 @@ type 'a t : immutable_data with 'a = { mutable x : 'a }
270270
Line 1, characters 0-55:
271271
1 | type 'a t : immutable_data with 'a = { mutable x : 'a }
272272
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
273-
Error: The kind of type "t" is mutable_data with 'a @@ many unyielding
273+
Error: The kind of type "t" is mutable_data with 'a @@ unyielding many
274274
because it's a boxed record type.
275275
But the kind of type "t" must be a subkind of immutable_data with 'a
276276
because of the annotation on the declaration of the type t.

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

Lines changed: 4 additions & 4 deletions
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 unyielding 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 unyielding
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 unyielding
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 unyielding 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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ Error: Signature mismatch:
141141
type 'a t = Foo of 'a constraint 'a = 'b ref
142142
is not included in
143143
type 'a t : immutable_data with 'b constraint 'a = 'b ref
144-
The kind of the first is mutable_data with 'b @@ many unyielding
144+
The kind of the first is mutable_data with 'b @@ unyielding many
145145
because of the definition of t at line 4, characters 2-46.
146146
But the kind of the first must be a subkind of immutable_data with 'b
147147
because of the definition of t at line 2, characters 2-59.

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ Line 4, characters 0-48:
5959
4 | type 'a t : immutable_data with 'a = 'a F(Ref).t
6060
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6161
Error: The kind of type "'a F(Ref).t" is mutable_data
62-
with 'a @@ many unyielding
62+
with 'a @@ unyielding many
6363
because of the definition of t at line 2, characters 2-40.
6464
But the kind of type "'a F(Ref).t" must be a subkind of immutable_data
6565
with 'a
@@ -80,7 +80,7 @@ Line 4, characters 0-38:
8080
4 | type 'a t : mutable_data = 'a F(Ref).t
8181
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
8282
Error: The kind of type "'a F(Ref).t" is mutable_data
83-
with 'a @@ many unyielding
83+
with 'a @@ unyielding many
8484
because of the definition of t at line 2, characters 2-40.
8585
But the kind of type "'a F(Ref).t" must be a subkind of mutable_data
8686
because of the definition of t at line 4, characters 0-38.

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,21 @@ end = struct
367367
type 'a t : immutable_data with 'a @@ portable contended portable
368368
end
369369
[%%expect {|
370+
Line 4, characters 40-48:
371+
4 | type 'a t : immutable_data with 'a @@ portable contended portable
372+
^^^^^^^^
373+
Warning 213: This portability is overriden by portable later.
374+
375+
Line 4, characters 40-48:
376+
4 | type 'a t : immutable_data with 'a @@ portable contended portable
377+
^^^^^^^^
378+
Warning 213: This portability is overriden by portable later.
379+
380+
Line 4, characters 40-48:
381+
4 | type 'a t : immutable_data with 'a @@ portable contended portable
382+
^^^^^^^^
383+
Warning 213: This portability is overriden by portable later.
384+
370385
module M : sig type 'a t : immutable_data with 'a @@ portable end
371386
|}]
372387

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ type 'a t : immutable_data = Foo of { mutable x : 'a }
132132
Line 1, characters 0-54:
133133
1 | type 'a t : immutable_data = Foo of { mutable x : 'a }
134134
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
135-
Error: The kind of type "t" is mutable_data with 'a @@ many unyielding
135+
Error: The kind of type "t" is mutable_data with 'a @@ unyielding many
136136
because it's a boxed variant type.
137137
But the kind of type "t" must be a subkind of immutable_data
138138
because of the annotation on the declaration of the type t.
@@ -274,7 +274,7 @@ type 'a t : immutable_data with 'a = Foo of { mutable x : 'a }
274274
Line 1, characters 0-62:
275275
1 | type 'a t : immutable_data with 'a = Foo of { mutable x : 'a }
276276
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
277-
Error: The kind of type "t" is mutable_data with 'a @@ many unyielding
277+
Error: The kind of type "t" is mutable_data with 'a @@ unyielding many
278278
because it's a boxed variant type.
279279
But the kind of type "t" must be a subkind of immutable_data with 'a
280280
because of the annotation on the declaration of the type t.

0 commit comments

Comments
 (0)