1
1
(* TEST
2
2
* expect
3
3
*)
4
- (* CR layouts v2.9: all error messages below here are unreviewed *)
5
4
6
5
module type S = sig type t [@@ immediate] end ;;
7
6
module F (M : S ) : S = M ;;
@@ -149,6 +148,9 @@ Error: The layout of type string is value, because
149
148
But the layout of type string must be a sublayout of immediate, because
150
149
of the definition of t at line 2 , characters 2 -31.
151
150
| }];;
151
+ (* CR layouts v2.9: The "of the definition of t ..." part is not great and it
152
+ should only refer to definitions that type check. Fixing it will involve
153
+ building a second [final_env] in [transl_type_decl] which is costly. *)
152
154
153
155
(* Cannot directly declare a non-immediate type as immediate (variant) *)
154
156
module B = struct
@@ -177,6 +179,8 @@ Error: The layout of type t is value, because
177
179
But the layout of type t must be a sublayout of immediate, because
178
180
of the annotation on the declaration of the type t/ 2.
179
181
| }];;
182
+ (* CR layouts v2.9: Investigate why the "/2" is here and check if it's only limited
183
+ to expect tests. *)
180
184
181
185
(* Not guaranteed that t is immediate, so this is an invalid declaration *)
182
186
module C = struct
@@ -219,7 +223,6 @@ Error: Signature mismatch:
219
223
220
224
(* Same as above but with explicit signature *)
221
225
module M_invalid : S = struct type t = string end ; ;
222
- module FM_invalid = F (struct type t = string end );;
223
226
[%% expect{|
224
227
Line 1 , characters 23-49 :
225
228
1 | module M_invalid : S = struct type t = string end ;;
@@ -236,6 +239,23 @@ Error: Signature mismatch:
236
239
of the definition of t at line 1 , characters 20 -40.
237
240
|}];;
238
241
242
+ module FM_invalid = F (struct type t = string end );;
243
+ [%% expect{|
244
+ Line 1 , characters 20-50 :
245
+ 1 | module FM_invalid = F (struct type t = string end );;
246
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
247
+ Error : Modules do not match : sig type t = string end is not included in
248
+ S
249
+ Type declarations do not match :
250
+ type t = string
251
+ is not included in
252
+ type t : immediate
253
+ The layout of the first is value , because
254
+ it is the primitive value type string.
255
+ But the layout of the first must be a sublayout of immediate , because
256
+ of the definition of t at line 1 , characters 20 -40.
257
+ |}];;
258
+
239
259
(* Can't use a non-immediate type even if mutually recursive *)
240
260
module E = struct
241
261
type t = s [@@ immediate]
0 commit comments