✓
Passing Passing: the compiler rejects this program as expected.
Code
// Glyph discipline, the WATCH-ARM case — sibling of 690_357 (`=>` in a
// `! query` sweep arm). A `=>` inside a `! <field>` watch arm can never
// construct: the arm body grafts into a synthesized VOID interceptor unit,
// so the enclosing tor's branch cannot be produced from in there. Without
// the wall the construct survives checking (the graft is marked
// is_transformed_subtree, which checkers skip) and dies in emitted Zig.
// The wall lives in the store:watch transform, pre-graft — on BOTH watch
// collection paths (singleton and plural).
import std/io
import std/store
std/store:new(box, capacity: 4) { n: i64, m: i64 }
std/store:watch(box)
! n v |> std/io:print.ln("changed {{ v:d }}") => ran
tor work {}
| ran
| rejected
work = std/store:insert(box) { n: 1, m: 2 }
| row _ |> std/io:print.ln("ok")
| full |> std/io:print.ln("full")
work()
| ran |> std/io:print.ln("RAN")
| rejected |> std/io:print.ln("REJ")
Actual compiler output
error[KORU102]: std/store:watch(box): `=>` inside a `! n` arm has nothing to construct — the arm body grafts into a void synthesized unit, so a branch of the enclosing tor cannot be produced from in there. Hand the verdict out through the enclosing surface and branch after it returns.
--> tests/regression/600_STDLIB/690_STORE/690_359_construct_glyph_in_watch_arm/input.k:13:0
error[KORU161]: std/store:watch(box): unknown store - no std/store:new(box) found
--> tests/regression/600_STDLIB/690_STORE/690_359_construct_glyph_in_watch_arm/input.k:12:0
error[KORU161]: std/store:insert: unknown store 'box' - no std/store:new(box) found
--> tests/regression/600_STDLIB/690_STORE/690_359_construct_glyph_in_watch_arm/input.k:19:0Compiler must reject:
Compilation must fail with a diagnostic.
Flows
flow ~new click a branch to expand · @labels scroll to their anchor
new (box, capacity: 4, source: n: i64, m: i64)
flow ~watch click a branch to expand · @labels scroll to their anchor
watch (box)
subflow ~work click a branch to expand · @labels scroll to their anchor
insert (box, source: n: 1, m: 2)
flow ~work click a branch to expand · @labels scroll to their anchor
work
Test Configuration
MUST_ERROR