match bound by a let points at the let, not at its…Open and answer this issue on GitHub.
decision, bugs · opened 2026-11-19 · updated 2026-11-22 · 3 comments
Filed by the driver from the Found: of the run of issue-1625 (#1625) (owner, 2026-11-06).
a warning inside a match bound by a let points at the let, not at its expression: struct F { value: i64? } / fn main() { let fields: Vec[F] = [F { value: 3 }, F { value: null }]; for field in fields { let part = match field.value { null => 0, given => given ?? 0, }; println(part) } } gives NK1216 at 6:9 (let part = match ...) where the ?? is at line 8; let names = match false { true => "", false => "use a::{{B, C}};", } gives NK1111 at the let line too; the warning should point at the ?? or the string (it does for a ?? written directly in a let); suspected: the callers in check_fields.nika (NK1216) and check_host.nika unmarked_hole (NK1111) receive the enclosing statement’s span, not the expression’s; check: pass the expression’s span and run the probe
develop first: the run that wrote it may have used a binary older than the tip, so it may be fixed already (#1822: #1788 was filed from a probe a fix under #1754 had already made pass). A probe that passes there names the commit that fixed it (git log -400 --grep by topic, since a fix often lands under another issue’s number), and the run builds only a tests/compiler/tests/ test that pins it (docs/issues.md I13).std defect with a probe (nikaia run scripts/probe.nika -- SNIPPET; a lowered file that differs, with an uncached lower-std of a git archive HEAD copy, NIKAIA_LOWER_CACHE_SALT fresh and --sysroot COPY/crates, its lowered/ diffed against the copy’s, never the shared working tree’s, #1793), a defect in docs/, guide/, website/ or scripts/ (a stale example, a wrong rule) with the command or check that shows it; a behaviour the code does on purpose (name the function or ADR) closes it as by design. The Found line may lack them (#1710): the commit message, or the report’s Body: when closed, gives the probe or check with its expected output, the ADR or Part I-III section that says so, and its actual output (docs/issues.md I5, I6), and the cause, file and function, traced or suspected (I7).std defect in the compiler, a stale page example or rule in its page or docs/ file, a script defect in the script. Add a test in tests/compiler/tests/ unless a check that already runs turns red on it (name it: pre-push’s page-examples for guide/ and website/, check-adr-refs.py for a docs citation).The probe or check gives the expected output the first item names from its ADR or Part I-III section, and a tests/compiler/tests/ test (or the named check) that failed on the unfixed tree is green; or the probe already passes on develop and a test pins it, naming the commit that fixed it; or the issue is closed as by design, naming the function or ADR.
Generated by Claude Code
Brief queued: issue-2185
agent: builder model: opus max_turns: 200 budget_usd: 30 effort: medium —
Your work order is issue #2185, inlined below with its comments. There is no
brief written around it: plan your own steps from its To build list, build
them in order, commit after each finished step, and end when its Done when
holds (or at the limits of builder.md, reporting what is left). The
facts in your prompt are Core of docs/builder-facts.md; more on a topic:
nikaia run scripts/syntax.nika -- KEYWORD, a probe: nikaia run scripts/probe.nika -- SNIPPET.
Measure the issue against docs/issues.md while you work: what it lacked,
what was wrong in it. That answer goes into the report’s Issue: field.
A finding, a changed plan or a finished item also goes into the issue as a
comment (gh api repos/Nikaia-Foundation/Nikaia/issues/2185/comments -F body=@file,
ending with the Claude Code footer), rule I13.
develop in the main checkout; other agents’ uncommitted files are not yours: never touch or stage them.target/fast/nikaia run scripts/commit.nika -- REPORT (it adds exactly the report’s Files:); the driver pushes.cargo build --profile fast -p nikaia, lower-std and its fixpoint when a tools/*.nika changed, cargo fmt, cargo clippy --all-targets -- -D warnings, nikaia run scripts/pre-push.nika, the tests the issue names and the ones your change touches.CHANGELOG.md, badges and NK codes are the supervisor’s. New tests in Nikaia only: a Rust test file an older issue names is built as a tests/compiler/tests/ program, no Deviation: and no Issue: point (I9, #1671).Body:. Found: is only for what lies outside the area, cannot be fixed this run or needs a decision; the driver files it as an issue.std or the toolchain lacks stops the work, unless an ADR or Part I-III refuses it (name it): Result: blocked, Found: the gap with a probe, Needs: supervisor decision.NIKAIA_CACHE_LIMIT=2G; at the end delete your own clone’s target/ and target/release/nikaia-scratch.suspected, or does not mark (docs/issues.md I7), is a hypothesis: run the check that settles it (nikaia run scripts/where.nika -- NAME, the probe with a trace, callgrind for a cost) before you build on it (owner, 2026-11-16). Shown false: say so in Issue: as wrong I7: <what the check showed> (the driver comments it on the issue) and follow the real cause.Result: partial with what you ruled out, the probe, and the suspected file and function./home/user/Nikaia/docs/briefs/bugs/issue-2185.md.report.md)Fields: Result, Files, Commit, Body (optional), Fixes, Pushed, Tests, Gate, Deviation, Found, Needs, Changelog, Issue, Owner (a question for the owner), Comment (#N <text>, what to say on another issue; the driver posts it, one line each), Friction, Disk freed, and last Attribution: with your commit trailer lines below it.
Result:, Gate: (green or red <check>), Deviation:, Found: and the other fields with nothing to say hold the bare word: done, none. Anything after it reads as content.Result: done only when the issue’s Done when holds; partial with the items left otherwise.Deviation: only for an item of the issue built otherwise than written, or not built. Found: only for a defect outside your area, or one this run cannot fix: one defect per Found: line, with its probe and the output it gives, only the shapes that fail today, and the suspected file and function or cause unknown (#1695); a by-design behaviour is none (#1677). A correct program your own change refuses (a fail-closed check’s false refusal) is no Deviation: but one Found: line per shape, with its probe (#1680). Everything else goes into Body:; how you verified goes into Tests:.Issue: by docs/issues.md, How a run judges its issue: complete, or broke I<n>: ..., rules-gap: ..., wrong I<n>: ..., joined with ;; a point your own commit built gets (built) after its kind (rules-gap (built): ...), and the driver does not file it. complete is the bare word: prose after it (complete; the earlier runs ...) is filed as an improvement issue (#1931); history or a note for your own issue goes into Body: or Comment: #N <text>.done <sha>, report <path> (or BLOCKED: ... / PUSH REJECTED ...).Generated by Claude Code
Run: issue-2185, Result: done
Tokens: input 40, cache read 806281, cache write 38716, output 7101 Cost: 0.65 USD, time 1 min 22 s, turns 20
Result: done
Files: none
Commit: none
Body: closed as by design: ADR-024 D7 “A finding names the statement, not the expression” and ADR-300 D4 (“Expressions are not [recorded], so a type error inside a statement is reported on that statement: let x = f(g(y)) blames the whole let”); a match arm body is an expression (ast.nika MatchArm.body: Expr), so its enclosing statement is the let. Expressions carry no span (Expr::Coalesce { value, fallback, id }, Expr::LitStr { text, id }); only Expr::Binary has one (ADR-081 D1), and ADR-081 section 4 leaves “spans on every other expression” until something needs them. Probes on HEAD 7bf83a9c6 (target/fast/nikaia check): the issue’s match probe gives NK1216 at 6:9 on let part = match field.value {; let names = match false { true => "", false => "use a::{{B, C}};", } gives NK1111 at 2:5; and a ?? written directly in a let split over two lines (let part = / x ?? 0, x: i64) gives NK1216 at 3:5 on let part =, and let names = / "use a::{{B, C}};" gives NK1111 at 5:5: the direct form also points at the statement, so the two shapes behave alike. The callers (check_core_ops.nika check_core_ops_coalesce -> check_fields.nika nothing_to_fall_back_from; check_core_expr.nika check_core_expr_text -> check_host.nika unmarked_hole) pass on the statement span on purpose, since no expression span exists to pass. Pointing a caret inside a statement needs expression spans in the parser, which is a language-tooling decision (ADR-024 D7 waits on it), not a defect fix.
Fixes: none
Pushed: none
Tests: none run beyond the probes in Body (nothing changed)
Gate: green
Deviation: none
Found: none
Needs: none
Changelog: none
Issue: wrong I7: the Found says the callers “receive the enclosing statement’s span, not the expression’s”, but no expression span exists to pass (only Expr::Binary carries one, ADR-081 D1), and its claim that a ?? written directly in a let points at the ?? is false: a two-line let part = / x ?? 0 gives NK1216 on the let line too, so a single-line let only looked right; broke I6: the behaviour is decided by ADR-024 D7 and ADR-300 D4, which the Found did not check
Owner: should NK1216, NK1111 and other checker findings get expression-level spans (ADR-024 D7 says “the day expressions carry spans, both checks get narrower”), so that a warning inside a multi-line match arm points at its line and not the let?
Comment: none
Friction: none
Disk freed: none (cache target/nikaia-project-tests 560M, / 13G free; no new entry over 100 MB)
Attribution:
Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_01UVxJDutPTwP5Xj5HkGuidk
Expr has no span field, then read ADR-081, ADR-300 and finally ADR-024 D7. Building and testing cost nothing: no build was needed and the binary was already current.ast.nika Expr::Coalesce and Expr::LitStr carry only an id, and that only Expr::Binary has a span (ADR-081 D1).target/fast/nikaia check), one two-line direct-let probe, which disproved the issue’s comparison case, and the disk check. One probe was wasted: c.nika, an i64? coalesce that cannot warn at all.Found: that claims a wrong caret position against syntax.nika -- span or ADR-024 D7 before filing it. Or give builder.md one line saying that checker findings point at statements by design.?? written directly in a let” holds only because a one-line let puts the ?? on the same line.| knowledge: Core | a checker CheckFinding span is the enclosing statement’s; only Expr::Binary carries its own span. |
| Fact: Core | Checker findings point at the enclosing statement by design (ADR-024 D7, ADR-300 D4), so a caret on a multi-line statement’s first line is no defect: probe the direct form over two lines before filing. |
| Fact: Probes | To test a claim about which line a warning lands on, split the statement over several lines, since a one-line probe cannot tell the statement from the expression. |
One slip of mine: the report holds Fixes: none, which the rules forbid. It is harmless here because nothing was committed, but a later report should leave that line out.
Generated by Claude Code
Question for the owner (from the bug lane’s run on this issue):
Should NK1216, NK1111 and the other checker findings get expression-level spans, so that a warning inside a multi-line match arm points at its own line and not at the let?
Today this is by design: ADR-024 D7 (“A finding names the statement, not the expression”) and ADR-300 D4 (a type error is reported on the statement); per ADR-081 D1/§4 only Expr::Binary carries a span. ADR-024 D7 itself foresees the change “the day expressions carry spans”.
The bug lane has taken this issue out of its queue until the answer comes.
Generated by Claude Code