✓
Passing Passing: the compiler rejects this program as expected.
Code
// PINS: a regex match arm's destructure delivers named groups only — it
// implements no entry annotation, so `{ [row]row, col }` refuses KORU162
// naming the field and the annotation rather than dropping it. The same
// refused-never-ignored law as store's query arm (which implements
// [row]/[ordinal]/[id], 690_069).
import std/io
import std/regex
std/regex:match("21,9")
| `(?<row>[0-9]+),(?<col>[0-9]+)` { [row]row, col } |> std/io:print.ln("row={{ row:s }} col={{ col:s }}")
| no-match |> std/io:print.ln("no")
Actual compiler output
error[KORU162]: regex match: destructure field 'row' carries annotation '[row]' — a match delivers named groups only; honored or refused, never silently ignored
--> tests/regression/600_STDLIB/640_REGEX/640_017_match_destructure_annotation_refused/input.k:9:0Compiler must reject:
Compilation must fail with a diagnostic.
Flows
flow ~match click a branch to expand · @labels scroll to their anchor
match (expr: "21,9")
Test Configuration
MUST_ERROR