File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
ocaml/testsuite/tests/typing-modules Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -220,3 +220,28 @@ module F :
220
220
functor (X : sig val x : m end ) ->
221
221
sig module M : sig type t = int end type t = M. t end
222
222
| }];;
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
+ |}];;
You can’t perform that action at this time.
0 commit comments