Skip to content

Restore fine-grained ID errors#3303

Open
jakebailey wants to merge 5 commits intomainfrom
jabaile/fine-grained-id
Open

Restore fine-grained ID errors#3303
jakebailey wants to merge 5 commits intomainfrom
jabaile/fine-grained-id

Conversation

@jakebailey
Copy link
Copy Markdown
Member

This is a little hokey; I tried to do a method where a reporter was passed down but could not get it to work how I wanted.

This is an alternative; inferred types have a list of error nodes, and then things are tweaked so we can bubble info back out again, reporting errors but not interfering with other inferences.

This does seem to have the desired effect, and unblocks adding a the ID quickfix which wants more specific locations.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR restores more fine-grained --isolatedDeclarations (ID) error locations by tracking the specific AST nodes that force pseudochecker inference fallback (e.g. shorthand props, spreads, non-literal computed names) and reporting errors on those nodes while still emitting types from the real checker when necessary.

Changes:

  • Extend PseudoTypeInferred to carry ErrorNodes and have pseudochecker collect them for object/array literals that can’t be fully represented.
  • Update NodeBuilderImpl to (a) report inference fallback at the recorded error nodes and (b) fall back to the checker’s type serialization for PseudoTypeInferred in reuse paths to avoid wrong output in instantiated contexts.
  • Update submodule baseline outputs to reflect the restored error locations/type printing.

Reviewed changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
internal/pseudochecker/type.go Adds ErrorNodes to PseudoTypeInferred and constructor for inferred-with-errors.
internal/pseudochecker/lookup.go Collects and propagates error-node slices for object/array literal fallback decisions.
internal/checker/pseudotypenodebuilder.go Reports fallback at specific nodes and introduces checker-type fallback serialization for inferred pseudotypes.
internal/checker/nodebuilderimpl.go Routes reuse serialization through the new checker-fallback helper.
testdata/baselines/reference/submodule/** Baseline updates for error locations and emitted types.

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.

2 participants