✗
Failing This test is currently failing.
Failed: backend-exec
Error Details
output_emitted.zig:44:66: error: incompatible types: 'i64' and 'usize'
Failure Output
Showing last 10 of 16 lines
~^~~~
output_emitted.zig:44:68: note: type 'usize' here
{ const i = __koru_item_0; _ = &i; a.acc = a.acc + i;
^
referenced by:
main: output_emitted.zig:505:22
callMain [inlined]: /opt/homebrew/Cellar/zig/0.15.2_1/lib/zig/std/start.zig:618:22
callMainWithArgs [inlined]: /opt/homebrew/Cellar/zig/0.15.2_1/lib/zig/std/start.zig:587:20
main: /opt/homebrew/Cellar/zig/0.15.2_1/lib/zig/std/start.zig:602:28
1 reference(s) hidden; use '-freference-trace=5' to see all references Code
// RED PIN (2026-07-03): the `for(a..b)` loop variable is emitted as Zig `usize`,
// so NAIVE mixing with i64 arithmetic (`a.acc + i`) is a hard backend compile
// error — and the error that reaches the user is RAW ZIG pointing into
// output_emitted.zig ("incompatible types: 'i64' and 'usize'"), not a Koru
// diagnostic pointing at the .k source line. That leak is why every compute
// kernel carries `@as(i64, @intCast(i))` around its loop var (see the
// koru-benchmarks factorial/digitsum ports).
//
// Sibling of 010_063 (naive `%` on signed i64): same root — .k body-expressions
// are raw Zig strings with no Koru parse-and-lower layer (endeavor "A"). When
// that layer lands, the loop var should participate in the expression's integer
// context (here i64) and THIS TEST GOES GREEN. If instead the ruling is a
// Koru-level diagnostic demanding an explicit widening, this pin flips to
// MUST_FAIL with that diagnostic as expected_error — either way, the raw Zig
// leak is the defect being pinned. See baton_koru_expression_layer_raw_zig_gap.
//
// Semantics check: sum of i over [1,11) = 1+2+...+10 = 55.
import std/io
capture { acc: 0[i64] }
! as a |> for(1..11)
! each i |> captured { acc: a.acc + i }
| captured r |> std/io:print.ln("{{ r.acc:d }}")
Expected output
55
Flows
flow ~capture click a branch to expand · @labels scroll to their anchor
capture (source: acc: 0[i64])
Test Configuration
MUST_RUN