Name(v), reaches rustc instead of NK1252Open and answer this issue on GitHub.
ready · opened 2026-10-31 · updated 2026-10-31 · 0 comments
agent: builder
model: sonnet
max_turns: 80
budget_usd: 15
—
Problem. A pattern Name(v) that names a bare variant of an enum with several variants passes the checker and fails in rustc (“Cannot find tuple struct or tuple variant Name in this scope”). Part I (Patterns): a path with :: names a variant, a bare name binds; the short form of an enum with several variants is NK1252 (ADR-347 D3). Found by the tools lane architect while probing #1019 step 3 (2026-10-31).
Probe (today’s target/fast/nikaia run):
enum Slot {
Name(String),
Age(i64),
}
fn show(s: Slot) {
match s {
Name(v) => println(v),
Age(n) => println(f"{n}"),
}
}
fn main() {
show(Slot::Age(3))
}
Expected: refused by the checker, NK1252 naming Slot::Name in its help (or the code for an unknown name in a pattern, whichever Part I gives a variant written without its enum). Got: two rustc errors.
Suspected location (not traced to the line, medium sure): crates/nikaia/src/one_variant.rs expand rewrites only a short form spelled with the enum’s own name, so Name(v) (a variant’s name) is left for the checker, whose pattern check (crates/nikaia-std/src/tools/check_patterns.nika) does not resolve a bare tuple-pattern head and lets it through.
To build
NK1252, help naming the long form Slot::Name(v). Test tests/compiler/tests/a_bare_variant_name_in_a_pattern_is_refused.nika + .stderr.Generated by Claude Code