✓
Passing This code compiles and runs correctly.
Code
// 400_159 — the `\\ }` inside lib/drift.kz's `fn note` drifts the host
// brace counter; the effect proc's bare `k` (a for-capture, not a module
// name) must NOT be flagged KORU112. Program runs clean.
import std/io
import app/lib/drift
app/lib/drift:spin(count: 3)
! tick k |> std/io:print.ln("tick {{ k:d }}")
| done t |> std/io:print.ln("done {{ t:d }}")
Supporting Files
// Module fixture for 400_159: KORU112's module-scope scan must not be
// poisoned by brace drift in opaque host text.
//
// `fn note` carries a Zig multiline string (`\\`) whose text holds an
// unbalanced `}`. That is legal Zig and legal Koru — but a scope tracker
// that counts braces without knowing the `\\` spelling sees a close with
// no open, and every host line after it reads one level too shallow:
// fn-local `k` / `m` / `ring` below then look like MODULE declarations.
// The consumer-side trigger was an orphan `}` left behind by a partial
// edit (koru-rive bg-arm deletion) — same drift, and there the file was
// invalid Zig anyway, so KORU112's false positives were noise on top of
// the real brace error. Here the file is VALID: the only thing wrong is
// the check itself.
const std = @import("std");
fn note() void {
const s =
\\ }
;
_ = s;
const k: usize = 0;
_ = k;
}
fn more() void {
const m: usize = 0;
var ring = std.ArrayList(u8).empty;
ring.append(std.heap.page_allocator, 1) catch {};
ring.deinit(std.heap.page_allocator);
_ = m;
}
// Effect-branch proc: `k` below is a for-capture local, never a module
// name. Pre-fix, the drifted scan flags it as "declared by this module"
// and rejects the whole compile — KORU112 on an unrelated proc.
~pub tor spin { count: usize }
! tick usize
| done usize
~proc spin|zig {
var acc: usize = 0;
for (0..count) |k| {
tick(k);
acc += k;
}
return .{ .done = acc };
}
Actual
tick 0
tick 1
tick 2
done 3
Expected output
tick 0
tick 1
tick 2
done 3
Flows
flow ~spin click a branch to expand · @labels scroll to their anchor
spin (count: 3)
Test Configuration
MUST_RUN