Skip to content

Commit 89b1be9

Browse files
committed
Fix issue with uninitialized _param in recursive functions with unit argument.
Fixes #6719
1 parent 1d46abe commit 89b1be9

File tree

6 files changed

+32
-38
lines changed

6 files changed

+32
-38
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
- Avoid generation of `Curry` with reverse application `|>`. https://github.com/rescript-lang/rescript-compiler/pull/6876
5050
- Fix issue where the internal ppx for pipe `->` would not use uncurried application in uncurried mode. https://github.com/rescript-lang/rescript-compiler/pull/6878
5151
- 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
52+
- Fix issue with uninitialized `_param` in recursive functions with unit argument. https://github.com/rescript-lang/rescript-compiler/pull/6907
5253

5354
#### :house: Internal
5455

jscomp/core/lam_compile.ml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ and compile_recursive_let ~all_bindings (cxt : Lam_compile_context.t)
357357
it will be renamed into [method]
358358
when it is detected by a primitive
359359
*)
360-
~return_unit ~async ~one_unit_arg ?directive ~immutable_mask:ret.immutable_mask
360+
~return_unit ~async ~one_unit_arg:false ?directive ~immutable_mask:ret.immutable_mask
361361
(Ext_list.map params (fun x ->
362362
Map_ident.find_default ret.new_params x x))
363363
[
@@ -1465,7 +1465,6 @@ and compile_apply (appinfo : Lam.apply) (lambda_cxt : Lam_compile_context.t) =
14651465
*)
14661466
(* TODO: use [fold]*)
14671467
let _, assigned_params, new_params =
1468-
let args = if ret.params = [] then [] else args in
14691468
Ext_list.fold_left2 ret.params args (0, [], Map_ident.empty)
14701469
(fun param arg (i, assigns, new_params) ->
14711470
match arg with

jscomp/test/ocaml_re_test.js

Lines changed: 9 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

jscomp/test/uncurry_test.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/es6/stream.js

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -259,19 +259,17 @@ function empty(s) {
259259
}
260260

261261
function iter(f, strm) {
262-
let do_rec = function () {
263-
while(true) {
264-
let a = peek(strm);
265-
if (a === undefined) {
266-
return;
267-
}
268-
junk(strm);
269-
f(Caml_option.valFromOption(a));
270-
_param = undefined;
271-
continue;
272-
};
262+
let _param;
263+
while(true) {
264+
let a = peek(strm);
265+
if (a === undefined) {
266+
return;
267+
}
268+
junk(strm);
269+
f(Caml_option.valFromOption(a));
270+
_param = undefined;
271+
continue;
273272
};
274-
do_rec();
275273
}
276274

277275
function from(f) {

lib/js/stream.js

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -259,19 +259,17 @@ function empty(s) {
259259
}
260260

261261
function iter(f, strm) {
262-
let do_rec = function () {
263-
while(true) {
264-
let a = peek(strm);
265-
if (a === undefined) {
266-
return;
267-
}
268-
junk(strm);
269-
f(Caml_option.valFromOption(a));
270-
_param = undefined;
271-
continue;
272-
};
262+
let _param;
263+
while(true) {
264+
let a = peek(strm);
265+
if (a === undefined) {
266+
return;
267+
}
268+
junk(strm);
269+
f(Caml_option.valFromOption(a));
270+
_param = undefined;
271+
continue;
273272
};
274-
do_rec();
275273
}
276274

277275
function from(f) {

0 commit comments

Comments
 (0)