✓
Passing Passing: the compiler rejects this program as expected.
Code
// PINS: a stored write block whose second field carries a dotted head —
// `e.px: 1 e.py: 2` — fuses for want of a comma and refuses KORU161. The
// fused-field head is not only `name:`; a write head is `name.field:` or
// `name[i].field:`, and struct_literal.fusedFieldLine sees all of them.
import std/io
import std/store
std/store:new(ents, capacity: 4) { px: i64, py: i64 }
std/store:insert(ents) { px: 0, py: 0 }
std/store:query(ents)
! query e |> std/store:stored {
e.px: 1 e.py: 2
}
std/store:query(ents)
! query r |> std/io:print.ln("p {{ r.px:d }}")
Actual compiler output
error[KORU161]: std/store:stored: missing comma — 'e.py: 2' began a new field but was read as part of the field above it; separate fields with commas
--> tests/regression/600_STDLIB/690_STORE/690_346_stored_write_fused_dotted_head_refused/input.k:12:0Must fail at runtime with:
CONTAINS error[KORU161]
CONTAINS missing comma
CONTAINS 'e.py: 2'Flows
flow ~new click a branch to expand · @labels scroll to their anchor
new (ents, capacity: 4, source: px: i64, py: i64)
flow ~insert click a branch to expand · @labels scroll to their anchor
insert (ents, source: px: 0, py: 0)
flow ~query click a branch to expand · @labels scroll to their anchor
query (ents)
flow ~query click a branch to expand · @labels scroll to their anchor
query (ents)
Test Configuration
MUST_ERROR