Skip to content

Commit 9e16cb7

Browse files
committed
Simplify collect_prop_types
1 parent 44f24c9 commit 9e16cb7

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

compiler/syntax/src/jsx_v4.ml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -936,16 +936,16 @@ let map_binding ~config ~empty_loc ~pstr_loc ~file_name ~rec_flag binding =
936936
new_binding )
937937
else (None, binding, None)
938938

939-
let rec collect_prop_types types ({ptyp_loc; ptyp_desc} as full_type) =
939+
let rec collect_prop_types types {ptyp_loc; ptyp_desc} =
940940
match ptyp_desc with
941941
| Ptyp_arrow {arg; ret = {ptyp_desc = Ptyp_arrow _} as rest}
942942
when is_labelled arg.lbl || is_optional arg.lbl ->
943943
collect_prop_types ((arg.lbl, arg.attrs, ptyp_loc, arg.typ) :: types) rest
944944
| Ptyp_arrow {arg = {lbl = Nolabel}; ret} -> collect_prop_types types ret
945945
| Ptyp_arrow {arg; ret = return_value}
946946
when is_labelled arg.lbl || is_optional arg.lbl ->
947-
(return_value, (arg.lbl, arg.attrs, return_value.ptyp_loc, arg.typ) :: types)
948-
| _ -> (full_type, types)
947+
(arg.lbl, arg.attrs, return_value.ptyp_loc, arg.typ) :: types
948+
| _ -> types
949949

950950
let transform_structure_item ~config item =
951951
match item with
@@ -979,7 +979,7 @@ let transform_structure_item ~config item =
979979
|> Option.map Jsx_common.typ_vars_of_core_type
980980
|> Option.value ~default:[]
981981
in
982-
let _, prop_types = collect_prop_types [] pval_type in
982+
let prop_types = collect_prop_types [] pval_type in
983983
let named_type_list = List.fold_left arg_to_concrete_type [] prop_types in
984984
let ret_props_type =
985985
Typ.constr ~loc:pstr_loc
@@ -1068,7 +1068,7 @@ let transform_signature_item ~config item =
10681068
|> Option.map Jsx_common.typ_vars_of_core_type
10691069
|> Option.value ~default:[]
10701070
in
1071-
let _, prop_types = collect_prop_types [] pval_type in
1071+
let prop_types = collect_prop_types [] pval_type in
10721072
let named_type_list = List.fold_left arg_to_concrete_type [] prop_types in
10731073
let ret_props_type =
10741074
Typ.constr

0 commit comments

Comments
 (0)