From a4465d41d49637b007e2002d6a039f9b6a4e6388 Mon Sep 17 00:00:00 2001 From: Cristiano Calcagno Date: Wed, 24 Jul 2024 17:11:01 +0200 Subject: [PATCH] Fix issue with uninitialized `_param` in recursive functions with unit argument. Fixes https://github.com/rescript-lang/rescript-compiler/issues/6719 --- CHANGELOG.md | 1 + jscomp/core/lam_compile.ml | 1 + jscomp/test/uncurry_test.js | 1 - 3 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e692a5f1c..b79f0e2d78 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ - Ignore `@uncurry` attribute in uncurried mode, to avoid generating calls to `Curry` at runtime. https://github.com/rescript-lang/rescript-compiler/pull/6869 - Avoid generating calls to Curry when adjusting arity of uncurried functions. https://github.com/rescript-lang/rescript-compiler/pull/6870 - Fix build after calling without `-warn-error`, see https://github.com/rescript-lang/rescript-compiler/issues/6868 for more details. https://github.com/rescript-lang/rescript-compiler/pull/6877 +- Fix issue with uninitialized `_param` in recursive functions with unit argument. https://github.com/rescript-lang/rescript-compiler/pull/6907 # 11.1.3-rc.1 diff --git a/jscomp/core/lam_compile.ml b/jscomp/core/lam_compile.ml index 70a10fc9fb..9f7ced71f3 100644 --- a/jscomp/core/lam_compile.ml +++ b/jscomp/core/lam_compile.ml @@ -328,6 +328,7 @@ and compile_recursive_let ~all_bindings (cxt : Lam_compile_context.t) ]} [Alias] may not be exact *) + let params = if oneUnitArg then [] else params in let ret : Lam_compile_context.return_label = { id; diff --git a/jscomp/test/uncurry_test.js b/jscomp/test/uncurry_test.js index cbce7ce877..bca59b1ade 100644 --- a/jscomp/test/uncurry_test.js +++ b/jscomp/test/uncurry_test.js @@ -28,7 +28,6 @@ console.log([ function xx() { while(true) { - _param = undefined; continue ; }; }