File tree 2 files changed +5
-5
lines changed
2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -3704,8 +3704,8 @@ let rec subtype_rec env trace t1 t2 cstrs =
3704
3704
| (Tvariant {row_closed= true ; row_fields}, Tconstr (_, [] , _))
3705
3705
when extract_concrete_typedecl_opt env t2 |> Variant_coercion. type_is_variant ->
3706
3706
(match extract_concrete_typedecl env t2 with
3707
- | (_ , _ , {type_kind =Type_variant ( constructors ) ; type_attributes} ) ->
3708
- (match Variant_coercion. can_coerce_polyvariant_to_variant ~row_fields ~constructors ~type_attributes with
3707
+ | (_ , _ , {type_kind =Type_variant variant_constructors ; type_attributes} ) ->
3708
+ (match Variant_coercion. can_coerce_polyvariant_to_variant ~row_fields ~variant_constructors ~type_attributes with
3709
3709
| Ok _ -> cstrs
3710
3710
| Error _ -> (trace, t1, t2, ! univar_pairs)::cstrs)
3711
3711
| _ -> (trace, t1, t2, ! univar_pairs)::cstrs)
Original file line number Diff line number Diff line change @@ -152,11 +152,12 @@ let variant_configuration_can_be_coerced_raises ~is_spread_context ~left_loc
152
152
error = TagName {left_tag; right_tag};
153
153
}))
154
154
155
- let can_coerce_polyvariant_to_variant ~row_fields ~constructors ~type_attributes
155
+ let can_coerce_polyvariant_to_variant ~row_fields ~variant_constructors ~type_attributes
156
156
=
157
157
let polyvariant_runtime_representations =
158
158
row_fields
159
159
|> List. filter_map (fun (label , (field : Types.row_field )) ->
160
+ (* Check that there's no payload in the polyvariant *)
160
161
match field with
161
162
| Rpresent None -> Some label
162
163
| _ -> None )
@@ -167,11 +168,10 @@ let can_coerce_polyvariant_to_variant ~row_fields ~constructors ~type_attributes
167
168
Error `PolyvariantConstructorHasPayload
168
169
else
169
170
let is_unboxed = Ast_untagged_variants. has_untagged type_attributes in
170
- print_endline (string_of_bool is_unboxed);
171
171
if
172
172
List. for_all
173
173
(fun polyvariant_value ->
174
- constructors
174
+ variant_constructors
175
175
|> List. exists (fun (c : Types.constructor_declaration ) ->
176
176
let constructor_name = Ident. name c.cd_id in
177
177
match
You can’t perform that action at this time.
0 commit comments