File tree 2 files changed +28
-2
lines changed
testsuite/tests/typing-layouts
2 files changed +28
-2
lines changed Original file line number Diff line number Diff line change @@ -716,3 +716,30 @@ Error: Function arguments and returns must be representable.
716
716
it's the type of a function argument .
717
717
|}]
718
718
719
+ (* **********************************)
720
+ (* Test 11 : [any] in package types * )
721
+
722
+ module type S = sig
723
+ type t : any
724
+ end
725
+
726
+ module C : S = struct
727
+ type t = float
728
+ end
729
+
730
+ let x = (module C : S with type t = 'a )
731
+
732
+ (* This should be accepted *)
733
+ [%% expect{|
734
+ module type S = sig type t : any end
735
+ module C : S
736
+ Line 9 , characters 8-39 :
737
+ 9 | let x = (module C : S with type t = 'a )
738
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
739
+ Error : This expression has type (module S with type t = C. t)
740
+ but an expression was expected of type (module S with type t = 'a)
741
+ The layout of C. t is any, because
742
+ of the definition of t at line 2 , characters 2 -14.
743
+ But the layout of C. t must be a sublayout of value, because
744
+ it's a type declaration in a first- class module .
745
+ | }]
Original file line number Diff line number Diff line change @@ -3272,9 +3272,8 @@ let type_package env m p fl =
3272
3272
in
3273
3273
List. iter
3274
3274
(fun (n , ty ) ->
3275
- (* CR layouts v5: relax value requirement. *)
3276
3275
try Ctype. unify env ty
3277
- (Ctype. newvar (Jkind. value ~why: Structure_element ))
3276
+ (Ctype. newvar (Jkind. any ~why: Dummy_jkind ))
3278
3277
with Ctype. Unify _ ->
3279
3278
raise (Error (modl.mod_loc, env, Scoping_pack (n,ty))))
3280
3279
fl';
You can’t perform that action at this time.
0 commit comments