@@ -221,31 +221,6 @@ module F :
221
221
sig module M : sig type t = int end type t = M. t end
222
222
| }];;
223
223
224
- (* In cases where the package constraint involves a type variable from the
225
- current ty var env, it can affect inference. t1 below should check but not
226
- t2. *)
227
- module type S = sig
228
- type t : immediate
229
- end
230
-
231
- type 'a t = (module S with type t = 'a )
232
-
233
- type t1 = int t
234
- type t2 = string t
235
- [%% expect{|
236
- module type S = sig type t : immediate end
237
- type ('a : immediate) t = (module S with type t = 'a )
238
- type t1 = int t
239
- Line 8 , characters 10-16 :
240
- 8 | type t2 = string t
241
- ^^^^^^
242
- Error : This type string should be an instance of type ('a : immediate)
243
- The layout of string is value , because
244
- it is the primitive value type string.
245
- But the layout of string must be a sublayout of immediate , because
246
- of the definition of t at line 5 , characters 0 -39.
247
- |}];;
248
-
249
224
(* Checking such a constraint may require expanding definitions from the module
250
225
being updated. *)
251
226
module type S = sig
@@ -330,3 +305,28 @@ Line 1, characters 13-61:
330
305
Error : In the constrained signature, type t is defined to be [< `A ].
331
306
Package `with ' constraints may only be used on abstract types.
332
307
| }]
308
+
309
+ (* In cases where the package constraint involves a type variable from the
310
+ current ty var env, it can affect inference. t1 below should check but not
311
+ t2. *)
312
+ module type S = sig
313
+ type t : immediate
314
+ end
315
+
316
+ type 'a t = (module S with type t = 'a )
317
+
318
+ type t1 = int t
319
+ type t2 = string t
320
+ [%% expect{|
321
+ module type S = sig type t : immediate end
322
+ type ('a : immediate) t = (module S with type t = 'a )
323
+ type t1 = int t
324
+ Line 8 , characters 10-16 :
325
+ 8 | type t2 = string t
326
+ ^^^^^^
327
+ Error : This type string should be an instance of type ('a : immediate)
328
+ The layout of string is value , because
329
+ it is the primitive value type string.
330
+ But the layout of string must be a sublayout of immediate , because
331
+ of the definition of t at line 5 , characters 0 -39.
332
+ |}];;
0 commit comments