From 660e61dc433fc224da1406a3142f2d8925d57f67 Mon Sep 17 00:00:00 2001 From: Cristiano Calcagno Date: Wed, 24 May 2023 03:52:15 +0200 Subject: [PATCH] Fix issue where uncurried type internals leak in type error. Fixes https://github.com/rescript-lang/rescript-compiler/issues/6263 --- CHANGELOG.md | 5 +++++ jscomp/syntax/src/res_outcome_printer.ml | 3 +++ 2 files changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index be569493af..01f20d52d4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,11 @@ - Introduced a new `%ffi` extension that provides a more robust mechanism for JavaScript function interoperation by considering function arity in type constraints. This enhancement improves safety when dealing with JavaScript functions by enforcing type constraints based on the arity of the function. [PR #6251](https://github.com/rescript-lang/rescript-compiler/pull/6251) +#### :bug: Bug Fix + +- Fix issue where uncurried type internals leak in type error. https://github.com/rescript-lang/rescript-compiler/pull/6264 + + # 11.0.0-beta.1 #### :rocket: Main New Feature diff --git a/jscomp/syntax/src/res_outcome_printer.ml b/jscomp/syntax/src/res_outcome_printer.ml index c193f14344..da54dc626a 100644 --- a/jscomp/syntax/src/res_outcome_printer.ml +++ b/jscomp/syntax/src/res_outcome_printer.ml @@ -217,6 +217,9 @@ let rec printOutTypeDoc (outType : Outcometree.out_type) = -> (* function$<(int, int) => int, [#2]> -> (. int, int) => int *) printOutArrowType ~uncurried:true arrowType + | Otyp_constr (Oide_ident "function$", [Otyp_var _; _arity]) -> + (* function$<'a, arity> -> _ => _ *) + printOutTypeDoc (Otyp_stuff "_ => _") | Otyp_constr (outIdent, []) -> printOutIdentDoc ~allowUident:false outIdent | Otyp_manifest (typ1, typ2) -> Doc.concat [printOutTypeDoc typ1; Doc.text " = "; printOutTypeDoc typ2]