Skip to content

Commit 030d069

Browse files
committed
fix a bug in recur
1 parent 03d5fb3 commit 030d069

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/algorithm/recur.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,11 @@ pub fn recur(is_leaf: SigNode, children: SigNode, combine: SigNode, env: &mut Ui
106106
Value::from_row_values(child_nodes, env)?
107107
};
108108
if call_combine {
109+
env.push_all(
110+
(consts.iter())
111+
.take(combine.sig.args().saturating_sub(2))
112+
.cloned(),
113+
);
109114
env.push(children_value);
110115
if combine.sig.args() > 1 {
111116
env.push(value);

src/check.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -426,8 +426,11 @@ impl VirtualEnv {
426426
self.handle_args_outputs(f.args(), f.outputs() + 1);
427427
}
428428
Recur => {
429-
let [_is_leaf, children, _combine] = get_args(args)?;
430-
let args = children.args();
429+
let [is_leaf, children, combine] = get_args(args)?;
430+
let args = is_leaf
431+
.args()
432+
.max(children.args())
433+
.max(combine.args().saturating_sub(1).max(1));
431434
self.handle_args_outputs(args, 1);
432435
}
433436
Sys(SysOp::ReadLines) => {

0 commit comments

Comments
 (0)