Skip to content

fix(analyser): analyse a statement past a name nothing declares 🔍 - #569

Merged
timfennis merged 1 commit into
masterfrom
bugfix/analyse-past-unknown-names
Nov 29, 2026
Merged

timfennis merged 1 commit into
masterfrom
bugfix/analyse-past-unknown-names

Conversation

@timfennis

Copy link
Copy Markdown
Owner

A top-level statement with a name nothing declares wasn't analysed at all. The names it declared were marked as failed, but nothing else it did counted. When the statement was a loop, as in

let robots = [];
for line in input.lines {
    let px, py, vx, vy = line.signed_nums;   // renamed to `nums`
    robots.push((px, py, vx, vy));
}

the push never reached the analyser, so robots stayed a list of Unknown. Every later use of it was then reported, here four [] errors at one call of a function that indexes its elements and another at a comprehension, on top of the one real error.

What changes:

  • The resolver carries on past a name nothing declares, written as a variable, a callee or a member (x, f(x), x.f, x.f()), and resolves it to no symbol. Every such name is reported, so missing(other) reports both.
  • The analyser types such a name as a failed check and analyses the rest of the statement. A call of one gives a failed check and marks what it could have said about its arguments as failed, as a call of a failed value already did. In the example, robots holds failed checks and only signed_nums is reported.
  • Any other resolver error (a duplicate parameter, a redefinition, an unknown assignment target or type) still stops its statement, which isn't analysed, as before.
  • The LSP doesn't mark a name nothing declares as a built-in, and still refuses to rename while one is in the program.

Written with AI (Claude Code), all of it.

🤖 Generated with Claude Code

Co-authored-by: Claude Opus 5.5 noreply@anthropic.com

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-29T13:12:34.671488Z 83ae1c0 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@timfennis
timfennis merged commit 8008264 into master Nov 29, 2026
1 check passed
@timfennis
timfennis deleted the bugfix/analyse-past-unknown-names branch November 29, 2026 13:17
timfennis added a commit that referenced this pull request Nov 29, 2026
…h place 📌 (#570)

An error found in a generic function's body is reported at the call that
needed it, with a note pointing into the body. When the body failed the
same way in several places, the call got one error per place, all with
the same message at the same span. In an editor they show as copies of
one diagnostic on the call's line. In `fn next(robs) { for rob in robs {
let pos = (rob[0], rob[1]); let vel = (rob[2], rob[3]); … } }`, a bad
call of `next` got four identical `[]` errors.

What changes:
- An error a call already got, with the same message, label and help,
gains a note at the new place instead of being reported again. The call
above gets one error with a note at each of `rob[0]`…`rob[3]`.
- This applies only to errors reported through calls. Other errors are
still dropped only when they're exact copies.

Related: #569, which removes the cascade that produced these errors in
the first place.

Written with AI (Claude Code), all of it.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant