Skip to content

fix(analyser): don't report errors that follow from an earlier one 🧯 - #348

Merged
timfennis merged 1 commit into
feat/type-checkerfrom
feature/error-type-pr
Nov 13, 2026
Merged

timfennis merged 1 commit into
feat/type-checkerfrom
feature/error-type-pr

Conversation

@timfennis

Copy link
Copy Markdown
Owner

Closes #326. When a check failed, the analyser gave the failed expression the type Any, and everything built from it could fail again, so one mistake gave several errors whose help pointed the wrong way:

struct Player { name: String, score: Int }
let players = [Player("ann", 3), Player("bob", 5)];
print(players.map(fn(p) => p.len).sum());

reported the missing len and then "No function called 'sum' found that matches the arguments 'List'", with a hint to cast. It now reports only the first. This is also groundwork for making Any explicit (#331), where an error-recovery Any would cause even more such errors.

  • A failed check gives the new StaticType::Error, which fits anything both ways, joins with anything as itself, and iterates and unpacks as itself. It's only used by the analyser: the types it hands to the compiler, VM and LSP turn it into Any, which is what hover and inlay hints showed before.
  • A call whose arguments (or callee) contain it is skipped without a report, and returns it; the unknowns it would have settled become it too, so a lambda passed to it stays quiet. The places that reported a failure and returned Any (no overload, a committed overload that didn't fit, tuple index out of bounds, growing recursion, not iterable, a failed unpack, bad annotations, a type that grows too large, names in a statement with name errors) now return it.
  • A literal keeps its own type when an error is written into it, and the debug-build check of early picks skips picks whose arguments now contain it.

As with rustc and TypeScript, a call passed a failed value reports nothing about its other arguments either. Errors in a value's declared type are still reported: after let s: String = missing();, let n: Int = s; is still an error. Every existing test program reports the same errors as before; analysis time is unchanged.

🤖 Generated with Claude Code

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

chatgpt-codex-connector Bot commented Nov 13, 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-13T21:20:53.311935Z 5dcf33a 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 6579558 into feat/type-checker Nov 13, 2026
1 check passed
@timfennis
timfennis deleted the feature/error-type-pr branch November 13, 2026 21:22
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