Skip to content

feat(analyser): point a write that doesn't fit at its declaration 📍 - #574

Open
timfennis wants to merge 1 commit into
masterfrom
feature/assignment-error-points-at-declaration
Open

timfennis wants to merge 1 commit into
masterfrom
feature/assignment-error-points-at-declaration

Conversation

@timfennis

@timfennis timfennis commented Nov 29, 2026 •

Copy link
Copy Markdown
Owner

A type error on an assignment said "mismatched types: found String but expected Int", underlined the whole statement, and never said which variable it was or why it was an Int. The help under it explained the rule in three sentences and suggested Any.

What changes:

  • An assignment to a variable, or an annotated let, that doesn't fit says can't assign a String to `p2`, which holds an Int. It's at the value, labelled this is a String, with a note at the variable's name where it's declared: `p2` is declared as an Int here. Destructuring gives each variable its own error and note.
  • A value a function returns that doesn't fit its annotation says can't return a String from `bad`, which returns an Int (from a function that returns … for a lambda). It's at the returned value, the body's last one for an implicit return, with a note at the -> Int annotation.
  • The resolver records where each variable is declared (NameResolver::declared_at) for the note.
  • The general help about a variable holding one type is gone, as the note says what it did. The help for a number written without a . and for a variable that starts as () is now one line each.
  • () takes no article in messages: "which holds ()".

Index and field writes (xs[0] = "a", p.x = "ten") still say "mismatched types". Index writes still underline the whole statement, as their error comes from the []= call.

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

🤖 Generated with Claude Code

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

An assignment, an annotated let or a return that doesn't fit names the
variable or function, labels the value, and notes where its type is
declared. The help that explained the rule is gone or cut to one line.

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-29T20:19:14.057041Z 0990638 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.

This branch has not been deployed

No deployments
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