From cfdb4e8084873cc462c307cfb5171a18475c0f5d Mon Sep 17 00:00:00 2001 From: Cristiano Calcagno Date: Fri, 20 Dec 2024 09:21:47 +0100 Subject: [PATCH] Remove more checks for `function$`. --- compiler/syntax/src/jsx_common.ml | 6 ------ compiler/syntax/src/jsx_v4.ml | 8 ++++++-- compiler/syntax/src/res_printer.ml | 3 +-- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/compiler/syntax/src/jsx_common.ml b/compiler/syntax/src/jsx_common.ml index 1e749be686..41a7fc685c 100644 --- a/compiler/syntax/src/jsx_common.ml +++ b/compiler/syntax/src/jsx_common.ml @@ -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 diff --git a/compiler/syntax/src/jsx_v4.ml b/compiler/syntax/src/jsx_v4.ml index d3cbb074d8..ad2f7ad5fd 100644 --- a/compiler/syntax/src/jsx_v4.ml +++ b/compiler/syntax/src/jsx_v4.ml @@ -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 @@ -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 diff --git a/compiler/syntax/src/res_printer.ml b/compiler/syntax/src/res_printer.ml index 855f6f6d45..892678d544 100644 --- a/compiler/syntax/src/res_printer.ml +++ b/compiler/syntax/src/res_printer.ml @@ -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