File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed
Expand file tree Collapse file tree 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 =
37043704 | (Tvariant {row_closed= true ; row_fields}, Tconstr (_, [] , _))
37053705 when extract_concrete_typedecl_opt env t2 |> Variant_coercion. type_is_variant ->
37063706 (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
37093709 | Ok _ -> cstrs
37103710 | Error _ -> (trace, t1, t2, ! univar_pairs)::cstrs)
37113711 | _ -> (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
152152 error = TagName {left_tag; right_tag};
153153 }))
154154
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
156156 =
157157 let polyvariant_runtime_representations =
158158 row_fields
159159 |> List. filter_map (fun (label , (field : Types.row_field )) ->
160+ (* Check that there's no payload in the polyvariant *)
160161 match field with
161162 | Rpresent None -> Some label
162163 | _ -> None )
@@ -167,11 +168,10 @@ let can_coerce_polyvariant_to_variant ~row_fields ~constructors ~type_attributes
167168 Error `PolyvariantConstructorHasPayload
168169 else
169170 let is_unboxed = Ast_untagged_variants. has_untagged type_attributes in
170- print_endline (string_of_bool is_unboxed);
171171 if
172172 List. for_all
173173 (fun polyvariant_value ->
174- constructors
174+ variant_constructors
175175 |> List. exists (fun (c : Types.constructor_declaration ) ->
176176 let constructor_name = Ident. name c.cd_id in
177177 match
You can’t perform that action at this time.
0 commit comments