✓
Passing This code compiles and runs correctly.
Code
// PINS: a `! sweep` arm may call a tor that has EFFECT branches.
//
// `beats` fires `! beat` k times and then `| done`. Called from inside a sweep
// arm, the sweep-body lowering emits the plain single-argument form:
//
// const result = main_module.beats_event.handler(.{ .k = n });
// expected 2 argument(s), found 1
//
// The CAUSE is not the sweep — it is 400_175. A sweep body is transplanted into
// a synthesized subflow (`__store_sweepbody_*`), and a subflow body that calls
// an effect-branch event emits the call in its no-effect form, dropping the
// handler struct. The identical error reproduces with no store and no sweep at
// all; that probe is 400_175, and this test is the store's instance of it.
//
// It earns its own pin anyway: the transplant is the store's, so this shape can
// break independently of the general case (capture threading, projection binds,
// the row-binding rewrite all run here and not there). When 400_175 goes green
// this should follow — and if it does not, the difference is the store's.
//
// The sweep is CHAINED here on purpose so it is not 690_081 wearing a different
// hat: statement position is fixed by putting a step in front, and this program
// has one and still fails.
//
// Found in koru-examples/downloads, where a `! sweep` arm calls curl's `poll`
// to advance a borrowed batch — `! progress` and `! finished` are the whole
// point of polling, so an arm that cannot call an effect-branch tor cannot
// drive a transfer at all. Reproduced here with no curl and no vaxis.
const std = @import("std");
~import std/io
~import std/store
~std/store:new(nums, capacity: 4) { n: i64 }
~tor beats { k: i64 }
! beat i64
| done
~proc beats|zig {
var i: i64 = 0;
while (i < k) : (i += 1) beat(i);
return .{ .done = .{} };
}
~std/store:insert(nums) { n: 2 }
| row _ |> _
~std/io:print.ln("start") |> std/store:sweep(nums)
! sweep e |> beats(k: e.n)
! beat b |> std/io:print.ln("beat {{ b:d }}")
| done |> _
Actual
start
beat 0
beat 1
Expected output
start
beat 0
beat 1
Flows
flow ~new click a branch to expand · @labels scroll to their anchor
new (expr: nums, capacity: 4, source: n: i64)
flow ~insert click a branch to expand · @labels scroll to their anchor
insert (expr: nums, source: n: 2)
flow ~print.ln click a branch to expand · @labels scroll to their anchor
print.ln (expr: "start")
Test Configuration
MUST_RUN