From 8441355486e7e9b93dc78268b05f31092bd87877 Mon Sep 17 00:00:00 2001 From: Cristiano Calcagno Date: Thu, 19 Dec 2024 20:03:40 +0100 Subject: [PATCH] Revise gentype change. --- compiler/gentype/TranslateCoreType.ml | 1 + compiler/gentype/TranslateTypeExprFromTypes.ml | 3 ++- compiler/ml/ast_uncurried.ml | 5 +++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/compiler/gentype/TranslateCoreType.ml b/compiler/gentype/TranslateCoreType.ml index 5ade1f08b8..efa11ae6f2 100644 --- a/compiler/gentype/TranslateCoreType.ml +++ b/compiler/gentype/TranslateCoreType.ml @@ -114,6 +114,7 @@ let rec translate_arrow_type ~config ~type_vars_gen and translateCoreType_ ~config ~type_vars_gen ?(no_function_return_dependencies = false) ~type_env (core_type : Typedtree.core_type) = + let core_type = Ast_uncurried.tcore_type_remove_function_dollar core_type in match core_type.ctyp_desc with | Ttyp_alias (ct, _) -> ct diff --git a/compiler/gentype/TranslateTypeExprFromTypes.ml b/compiler/gentype/TranslateTypeExprFromTypes.ml index 1e2303b92d..5f9eff9c42 100644 --- a/compiler/gentype/TranslateTypeExprFromTypes.ml +++ b/compiler/gentype/TranslateTypeExprFromTypes.ml @@ -312,7 +312,8 @@ let rec translate_arrow_type ~config ~type_vars_gen ~type_env ~rev_arg_deps {dependencies = all_deps; type_ = function_type} and translateTypeExprFromTypes_ ~config ~type_vars_gen ~type_env - (type_expr : Types.type_expr) = + (type_expr_ : Types.type_expr) = + let type_expr = Ast_uncurried.remove_function_dollar type_expr_ in match type_expr.desc with | Tvar None -> let type_name = diff --git a/compiler/ml/ast_uncurried.ml b/compiler/ml/ast_uncurried.ml index 4c6aabffdc..3e09e48e0e 100644 --- a/compiler/ml/ast_uncurried.ml +++ b/compiler/ml/ast_uncurried.ml @@ -101,3 +101,8 @@ let core_type_remove_function_dollar (typ : Parsetree.core_type) = match typ.ptyp_desc with | Ptyp_constr ({txt = Lident "function$"}, [t]) -> t | _ -> typ + +let tcore_type_remove_function_dollar (typ : Typedtree.core_type) = + match typ.ctyp_desc with + | Ttyp_constr (Pident {name = "function$"}, _, [t]) -> t + | _ -> typ