✓
Passing Passing: the compiler rejects this program as expected.
Code
// STRICT 1:1 (Lars-ratified 2026-06-12): destructure fields ↔ named groups
// must match BOTH ways, compile-time error from the transform (it owns
// pattern AND destructure at the same site). Here group `w` is captured
// but never destructured — unwanted capture must be spelled `(...)`.
import std/io
import std/regex
std/regex:match("2x3")
| `(?<l>[0-9]+)x(?<w>[0-9]+)` { l: i64 } |> std/io:print.ln("{{ l:d }}")
| no-match |> std/io:print.ln("no")
Actual compiler output
error[KORU162]: regex match: named group 'w' has no destructure field — take delivery, or make it non-capturing: spell it (...)
--> tests/regression/600_STDLIB/640_REGEX/640_007_reject_groups_field_mismatch/input.k:8:0Must contain:
has no destructure fieldFlows
flow ~match click a branch to expand · @labels scroll to their anchor
match (expr: "2x3")
Test Configuration
MUST_ERROR