✓
Passing Passing: the compiler rejects this program as expected.
Code
// Cut-2 restriction: no capture groups under alternation — a group on an
// untaken branch has no span, and "empty when skipped" is a silent lie.
// Rejected loudly at the match site.
import std/io
import std/regex
std/regex:match("b")
| `a|(?<x>b)` { x } |> std/io:print.ln("{{ x:s }}")
| no-match |> std/io:print.ln("no")
Actual compiler output
error[KORU162]: regex: cannot compile pattern `a|(?<x>b)`: GroupUnderAlternation
--> tests/regression/600_STDLIB/640_REGEX/640_009_reject_group_under_alternation/input.k:7:0Must contain:
GroupUnderAlternationFlows
flow ~match click a branch to expand · @labels scroll to their anchor
match (expr: "b")
Test Configuration
MUST_ERROR