✓
Passing This code compiles and runs correctly.
Code
// PINS: `std/grid:for(0..n, g)` refuses to run a range that outruns the
// grid — the check is spelled once before the loop and panics LOUDLY,
// naming the grid. Never clamped, never silently truncated: the range is
// the program's to get right.
import std/io
import std/grid
std/grid:new(cells, size: 8) { v: 0[i64] }
std/io:print.ln("before")
std/grid:for(0..9, cells)
! each i |> std/grid:stored { cells[i].v: i }
std/io:print.ln("unreachable")
Actual
before
thread 35103706 panic: std/grid:for: range outruns grid 'cells'
???:?:?: 0x100689c7f in _output_emitted.main_module.__grid_for_L12_event.__koru_handler_impl (???)
???:?:?: 0x100689877 in _output_emitted.main_module.flow1 (???)
???:?:?: 0x100689757 in _output_emitted.main (???)
???:?:?: 0x10068966b in _main (???)
???:?:?: 0x18b493dff in ??? (???)
???:?:?: 0x0 in ??? (???)
Expected patterns
Each line is a regex that must match the program output.
before
std/grid:for: range outruns grid 'cells'Flows
flow ~new click a branch to expand · @labels scroll to their anchor
new (cells, size: 8, source: v: 0[i64])
flow ~print.ln click a branch to expand · @labels scroll to their anchor
print.ln (expr: "before")
flow ~for click a branch to expand · @labels scroll to their anchor
for (0..9, cells)
flow ~print.ln click a branch to expand · @labels scroll to their anchor
print.ln (expr: "unreachable")
Test Configuration
MUST_RUN EXPECT_TRAP · exit # Zig panic handler aborts: 128 + SIGABRT(6) = 134.
134