✓
Passing Passing: the compiler rejects this program as expected.
Code
// Cut-2 restriction (same doctrine as backrefs): no capture groups under
// quantifiers — a repeated group has no single span, and silently keeping
// the last iteration is the trap every regex engine apologizes for.
// Rejected loudly at the match site.
import std/io
import std/regex
std/regex:match("aaa")
| `(?<x>a)+` { x } |> std/io:print.ln("{{ x:s }}")
| no-match |> std/io:print.ln("no")
Actual compiler output
error[KORU162]: regex: cannot compile pattern `(?<x>a)+`: GroupUnderQuantifier
--> tests/regression/600_STDLIB/640_REGEX/640_008_reject_group_under_quantifier/input.k:8:0Must contain:
GroupUnderQuantifierFlows
flow ~match click a branch to expand · @labels scroll to their anchor
match (expr: "aaa")
Test Configuration
MUST_ERROR