Skip to content

Commit

Permalink
Remove more checks for function$.
Browse files Browse the repository at this point in the history
  • Loading branch information
cristianoc committed Dec 20, 2024
1 parent f0a5eb6 commit cfdb4e8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
6 changes: 0 additions & 6 deletions compiler/syntax/src/jsx_common.ml
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,6 @@ let raise_error_multiple_component ~loc =
"Only one component definition is allowed for each module. Move to a \
submodule or other file if necessary."

let extract_uncurried typ =
if Ast_uncurried.core_type_is_uncurried_fun typ then
let _arity, t = Ast_uncurried.core_type_extract_uncurried_fun typ in
t
else typ

let remove_arity binding =
let rec remove_arity_record expr =
match expr.pexp_desc with
Expand Down
8 changes: 6 additions & 2 deletions compiler/syntax/src/jsx_v4.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1309,7 +1309,9 @@ let transform_structure_item ~config item =
check_multiple_components ~config ~loc:pstr_loc;
check_string_int_attribute_iter.structure_item
check_string_int_attribute_iter item;
let pval_type = Jsx_common.extract_uncurried pval_type in
let pval_type =
Ast_uncurried.core_type_remove_function_dollar pval_type
in
let core_type_of_attr = Jsx_common.core_type_of_attrs pval_attributes in
let typ_vars_of_core_type =
core_type_of_attr
Expand Down Expand Up @@ -1412,7 +1414,9 @@ let transform_signature_item ~config item =
| [] -> [item]
| [_] ->
check_multiple_components ~config ~loc:psig_loc;
let pval_type = Jsx_common.extract_uncurried pval_type in
let pval_type =
Ast_uncurried.core_type_remove_function_dollar pval_type
in
check_string_int_attribute_iter.signature_item
check_string_int_attribute_iter item;
let core_type_of_attr = Jsx_common.core_type_of_attrs pval_attributes in
Expand Down
3 changes: 1 addition & 2 deletions compiler/syntax/src/res_printer.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1616,9 +1616,8 @@ and print_typ_expr ~(state : State.t) (typ_expr : Parsetree.core_type) cmt_tbl =
in
let typ_doc =
let doc = print_typ_expr ~state n cmt_tbl in
match n.ptyp_desc with
match (Ast_uncurried.core_type_remove_function_dollar n).ptyp_desc with
| Ptyp_arrow _ | Ptyp_tuple _ | Ptyp_alias _ -> add_parens doc
| _ when Ast_uncurried.core_type_is_uncurried_fun n -> add_parens doc
| _ -> doc
in
Doc.group
Expand Down

0 comments on commit cfdb4e8

Please sign in to comment.