1
1
(* TEST
2
2
* expect
3
3
*)
4
+ (* CR layouts v2.9: all error messages below here are unreviewed *)
4
5
5
6
module type S = sig type t [@@ immediate] end ;;
6
7
module F (M : S ) : S = M ;;
@@ -143,7 +144,11 @@ end;;
143
144
Line 2 , characters 2-31 :
144
145
2 | type t = string [@@ immediate]
145
146
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
146
- Error : Type string has layout value, which is not a sublayout of immediate.
147
+ Error : The layout of Type string is value, because
148
+ it equals the primitive value type string .
149
+ But the layout of Type string must be a sublayout of immediate, because
150
+ of the annotation on the declaration of the type t.
151
+
147
152
| }];;
148
153
149
154
(* Cannot directly declare a non-immediate type as immediate (variant) *)
@@ -154,7 +159,11 @@ end;;
154
159
Line 2 , characters 2-41 :
155
160
2 | type t = Foo of int | Bar [@@ immediate]
156
161
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
157
- Error : Type t has layout value, which is not a sublayout of immediate.
162
+ Error : The layout of Type t is value, because
163
+ a boxed variant.
164
+ But the layout of Type t must be a sublayout of immediate, because
165
+ of the annotation on the declaration of the type t/ 2.
166
+
158
167
| }];;
159
168
160
169
(* Cannot directly declare a non-immediate type as immediate (record) *)
@@ -165,7 +174,11 @@ end;;
165
174
Line 2 , characters 2-38 :
166
175
2 | type t = { foo : int } [@@ immediate]
167
176
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
168
- Error : Type t has layout value, which is not a sublayout of immediate.
177
+ Error : The layout of Type t is value, because
178
+ a boxed record.
179
+ But the layout of Type t must be a sublayout of immediate, because
180
+ of the annotation on the declaration of the type t/ 3.
181
+
169
182
| }];;
170
183
171
184
(* Not guaranteed that t is immediate, so this is an invalid declaration *)
@@ -177,7 +190,11 @@ end;;
177
190
Line 3 , characters 2-26 :
178
191
3 | type s = t [@@ immediate]
179
192
^^^^^^^^^^^^^^^^^^^^^^^^
180
- Error : Type t has layout value, which is not a sublayout of immediate.
193
+ Error : The layout of Type t is value, because
194
+ the default layout for an abstract type .
195
+ But the layout of Type t must be a sublayout of immediate, because
196
+ of the annotation on the declaration of the type s.
197
+
181
198
| }];;
182
199
183
200
(* Can't ascribe to an immediate type signature with a non-immediate type *)
@@ -198,7 +215,11 @@ Error: Signature mismatch:
198
215
type t = string
199
216
is not included in
200
217
type t : immediate
201
- the first has layout value , which is not a sublayout of immediate .
218
+ The layout of the first is value , because
219
+ it equals the primitive value type string.
220
+ But the layout of the first must be a sublayout of immediate , because
221
+ of the annotation on the declaration of the type t.
222
+
202
223
|}];;
203
224
204
225
(* Same as above but with explicit signature *)
@@ -214,7 +235,11 @@ Error: Signature mismatch:
214
235
type t = string
215
236
is not included in
216
237
type t : immediate
217
- the first has layout value , which is not a sublayout of immediate .
238
+ The layout of the first is value , because
239
+ it equals the primitive value type string.
240
+ But the layout of the first must be a sublayout of immediate , because
241
+ of the annotation on the declaration of the type t.
242
+
218
243
|}];;
219
244
220
245
(* Can't use a non-immediate type even if mutually recursive *)
@@ -226,7 +251,11 @@ end;;
226
251
Line 2 , characters 2-26 :
227
252
2 | type t = s [@@ immediate]
228
253
^^^^^^^^^^^^^^^^^^^^^^^^
229
- Error : Type s has layout value, which is not a sublayout of immediate.
254
+ Error : The layout of Type s is value, because
255
+ it equals the primitive value type string .
256
+ But the layout of Type s must be a sublayout of immediate, because
257
+ of the annotation on the declaration of the type t/ 2.
258
+
230
259
| }];;
231
260
232
261
0 commit comments