Repository navigation
fix: resolve JSDoc '#' links to instance members - #65515
Open
刘亦达 (zhengdaodeguL) wants to merge 1 commit into
Open
刘亦达 (zhengdaodeguL) wants to merge 1 commit into
刘亦达 (zhengdaodeguL) wants to merge 1 commit into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #65507
Background
Foo#membershould resolve to the instance member (see #61433), but inTS 7 it resolves to the static member; TS 6 behaves correctly.
resolveJSDocMemberNamecallsresolveEntityNamefirst, which finds thestatic class export before the prototype/instance fallback can run. The Go
parser stores both
.and#spellings as qualified names, but the sourcespan between the left and right names still preserves which separator was
used.
Change
isJSDocHashLinkMemberName)and skip the static-first entity lookup for them, resolving through the
left symbol's prototype/instance type instead. Dot-qualified links keep
the existing static-first behavior.
getSymbolOfNameOrPropertyAccessExpressionso ordinary qualified-name checking cannot cache a static result first.
parity: no fallback to a same-named static member).
Adds
TestJSDocHashLinkResolvesToInstanceMember, covering the static link,the instance link, and a hash link with no instance member.
Verification
go test -run '^TestJSDocHashLinkResolvesToInstanceMember$' ./internal/checker— pass; the new test fails on base code.
go test ./internal/checker(full package) — pass.go build ./cmd/tsc— pass.gofmt -lclean on both changed files;git diff --checkclean.Not run: full
npx hereby test(too large for this environment; only thetargeted Go tests were run),
npx hereby lint,npx hereby check:format.