@@ -498,11 +498,11 @@ Line 6, characters 10-42:
498
498
Error : In this `with ' constraint , the new definition of t
499
499
does not match its original definition in the constrained signature :
500
500
Type declarations do not match :
501
- type t
501
+ type t = int
502
502
is not included in
503
503
type t : float64
504
- The layout of the first is value , because
505
- it 's a type declaration in a first-class module .
504
+ The layout of the first is immediate , because
505
+ it is the primitive immediate type int .
506
506
But the layout of the first must be a sublayout of float64 , because
507
507
of the definition of t at line 2 , characters 2 -18.
508
508
|}];;
@@ -516,14 +516,19 @@ module type S6_4f = sig
516
516
end ;;
517
517
[%% expect{|
518
518
module type S6_3 = sig type t : value end
519
- Line 6 , characters 33-34 :
519
+ Line 6 , characters 10-47 :
520
520
6 | val m : (module S6_3 with type t = t_float64 )
521
- ^
522
- Error : Signature package constraint types must have layout value .
523
- The layout of t_float64 is float64 , because
521
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
522
+ Error : In this `with ' constraint , the new definition of t
523
+ does not match its original definition in the constrained signature :
524
+ Type declarations do not match :
525
+ type t = t_float64
526
+ is not included in
527
+ type t : value
528
+ The layout of the first is float64 , because
524
529
of the definition of t_float64 at line 4 , characters 0 -24.
525
- But the layout of t_float64 must be a sublayout of value , because
526
- it 's a type declaration in a first - class module .
530
+ But the layout of the first must be a sublayout of value , because
531
+ of the definition of t at line 2 , characters 2 -16 .
527
532
|}];;
528
533
529
534
module type S6_5 = sig
@@ -541,11 +546,11 @@ Line 6, characters 10-44:
541
546
Error : In this `with ' constraint , the new definition of t
542
547
does not match its original definition in the constrained signature :
543
548
Type declarations do not match :
544
- type t
549
+ type t = string
545
550
is not included in
546
551
type t : immediate
547
552
The layout of the first is value , because
548
- it 's a type declaration in a first-class module .
553
+ it is the primitive value type string .
549
554
But the layout of the first must be a sublayout of immediate , because
550
555
of the definition of t at line 2 , characters 2 -20.
551
556
|}];;
@@ -561,34 +566,22 @@ Line 3, characters 10-39:
561
566
Error : In this `with ' constraint , the new definition of t
562
567
does not match its original definition in the constrained signature :
563
568
Type declarations do not match :
564
- type t
569
+ type t = s
565
570
is not included in
566
571
type t : immediate
567
572
The layout of the first is value , because
568
- it 's a type declaration in a first-class module .
573
+ of the definition of s at line 2 , characters 2 -8 .
569
574
But the layout of the first must be a sublayout of immediate , because
570
575
of the definition of t at line 2 , characters 2 -20.
571
576
|}];;
572
577
573
- (* CR layouts: S6_6'' should be fixed *)
574
578
module type S6_6'' = sig
575
579
type s = int
576
580
val m : (module S6_5 with type t = int )
577
581
end ;;
578
582
[%% expect{|
579
- Line 3 , characters 10-41 :
580
- 3 | val m : (module S6_5 with type t = int )
581
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
582
- Error : In this `with ' constraint , the new definition of t
583
- does not match its original definition in the constrained signature :
584
- Type declarations do not match :
585
- type t
586
- is not included in
587
- type t : immediate
588
- The layout of the first is value , because
589
- it 's a type declaration in a first-class module.
590
- But the layout of the first must be a sublayout of immediate , because
591
- of the definition of t at line 2 , characters 2 -20.
583
+ module type S6_6'' =
584
+ sig type s = int val m : (module S6_5 with type t = int ) end
592
585
| }];;
593
586
594
587
(* ****************************************)
729
722
730
723
let x = (module C : S with type t = 'a )
731
724
732
- (* This should be accepted *)
733
725
[%% expect{|
734
726
module type S = sig type t : any end
735
727
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 .
728
+ val x : (module S with type t = C .t ) = < module >
745
729
| }]
0 commit comments