Skip to content

refactor(parser): give type annotation names node ids 🏷️ - #228

Merged
timfennis merged 1 commit into
masterfrom
refactor/type-expr-node-ids
Oct 13, 2026
Merged

timfennis merged 1 commit into
masterfrom
refactor/type-expr-node-ids

Conversation

@timfennis

Copy link
Copy Markdown
Owner

The name resolver being built on feat/new-analyser will resolve type names through lexical scopes. Struct names are scoped like values, but they live in a separate type namespace. The resolver records its results in side tables keyed by NodeId, but type annotations had no node ids. Each name needs its own key: in Map<P, Q>, P and Q resolve separately. Parameter annotations can't borrow an owner's id either, because FunctionParameter has no node of its own. This follows the same approach as #225, which gave binding patterns and assignment targets their own ids.

  • TypeExpr::Name gets an id: NodeId. Both places that build one assign a fresh id: ordinary annotations, and the cast fast path for x as Int < 5.
  • The current analyser ignores the new field.
  • New parser tests check that every name in a nested annotation, and in the cast fast path, gets its own id.

TypeExpr::Tuple gets no id, because tuple types have no name to resolve. Nothing in the workspace compares annotations for equality, so including the id in the derived PartialEq changes no behaviour.

πŸ€– Generated with Claude Code

Name resolution needs to record what each type name refers to. Each name
in `Map<P, Q>` resolves separately, and annotations on parameters have
no node of their own, so give every `TypeExpr::Name` its own `NodeId`.

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

chatgpt-codex-connector Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
πŸ“ Code Review βœ… Completed 2026-10-13T13:39:15.053581Z ff6ea7a 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 77600eb into master Oct 13, 2026
1 check passed
@timfennis
timfennis deleted the refactor/type-expr-node-ids branch October 13, 2026 13:44
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