@@ -226,7 +226,7 @@ type type_mismatch =
226
226
| Variance
227
227
| Record_mismatch of record_mismatch
228
228
| Variant_mismatch of variant_change list
229
- | Unboxed_representation of position
229
+ | Unboxed_representation of position * attributes
230
230
| Immediate of Type_immediacy.Violation .t
231
231
232
232
let report_locality_mismatch first second ppf err =
@@ -469,10 +469,13 @@ let report_type_mismatch first second decl env ppf err =
469
469
report_record_mismatch first second decl env ppf err
470
470
| Variant_mismatch err ->
471
471
report_patch pp_variant_diff first second decl env ppf err
472
- | Unboxed_representation ord ->
472
+ | Unboxed_representation ( ord , attrs ) ->
473
473
pr " Their internal representations differ:@ %s %s %s."
474
474
(choose ord first second) decl
475
- " uses unboxed representation"
475
+ " uses unboxed representation" ;
476
+ if Builtin_attributes. has_unboxed attrs then
477
+ pr " @ Hint: %s %s has [%@unboxed]. Did you mean [%@%@unboxed]?"
478
+ (choose ord second first) decl
476
479
| Immediate violation ->
477
480
let first = StringLabels. capitalize_ascii first in
478
481
match violation with
@@ -618,8 +621,8 @@ module Record_diffing = struct
618
621
else
619
622
match rep1, rep2 with
620
623
| Record_unboxed _ , Record_unboxed _ -> None
621
- | Record_unboxed _ , _ -> Some (Unboxed_representation First )
622
- | _ , Record_unboxed _ -> Some (Unboxed_representation Second )
624
+ | Record_unboxed _ , _ -> Some (Unboxed_representation ( First , [] ) )
625
+ | _ , Record_unboxed _ -> Some (Unboxed_representation ( Second , [] ) )
623
626
624
627
| Record_float , Record_float -> None
625
628
| Record_float , _ ->
@@ -766,16 +769,21 @@ module Variant_diffing = struct
766
769
cstrs1 cstrs2 rep1 rep2
767
770
=
768
771
let err = compare ~loc env params1 params2 cstrs1 cstrs2 in
772
+ let attrs_of_only cstrs =
773
+ match cstrs with
774
+ | [cstr] -> cstr.Types. cd_attributes
775
+ | _ -> []
776
+ in
769
777
match err, rep1, rep2 with
770
778
| None , Variant_regular , Variant_regular
771
779
| None , Variant_unboxed , Variant_unboxed ->
772
780
None
773
781
| Some err , _ , _ ->
774
782
Some (Variant_mismatch err)
775
783
| None , Variant_unboxed , Variant_regular ->
776
- Some (Unboxed_representation First )
784
+ Some (Unboxed_representation ( First , attrs_of_only cstrs2) )
777
785
| None , Variant_regular , Variant_unboxed ->
778
- Some (Unboxed_representation Second )
786
+ Some (Unboxed_representation ( Second , attrs_of_only cstrs1) )
779
787
end
780
788
781
789
(* Inclusion between "private" annotations *)
0 commit comments