-
Notifications
You must be signed in to change notification settings - Fork 12.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Properly handle typeof this.xxx
in isTypeParameterPossiblyReferenced
#54208
Conversation
src/compiler/checker.ts
Outdated
return some(firstIdentifierSymbol.declarations, idDecl => isNodeDescendantOf(idDecl, tpScope)) || | ||
some((node as TypeQueryNode).typeArguments, containsReference); | ||
if (!isThisIdentifier(firstIdentifier)) { // Don't attempt to analyze typeof this.xxx | ||
const firstIdentifierSymbol = getResolvedSymbol(firstIdentifier); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just out of curiosity, where/why do things go wrong if firstIdentifier
is this
? Is it in this call to getResolvedSymbol
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it goes wrong because this
is never actually a symbol you can look up. In expressions, this
isn't even an identifier, it's encoded as a ThisExpression
AST node. However, a type query stores the dotted name as an EntityName
, and in those this
is just an identifier.
@typescript-bot test this |
Heya @ahejlsberg, I've started to run the abridged perf test suite on this PR at e67193d. You can monitor the build here. Update: The results are in! |
Heya @ahejlsberg, I've started to run the extended test suite on this PR at e67193d. You can monitor the build here. |
Heya @ahejlsberg, I've started to run the parallelized Definitely Typed test suite on this PR at e67193d. You can monitor the build here. Update: The results are in! |
Heya @ahejlsberg, I've started to run the diff-based user code test suite on this PR at e67193d. You can monitor the build here. Update: The results are in! |
Heya @ahejlsberg, I've started to run the diff-based top-repos suite on this PR at e67193d. You can monitor the build here. Update: The results are in! |
@ahejlsberg Here are the results of running the user test suite comparing There were infrastructure failures potentially unrelated to your change:
Otherwise... Everything looks good! |
@ahejlsberg Here they are:Comparison Report - main..54208
System
Hosts
Scenarios
Developer Information: |
@ahejlsberg Here are the results of running the top-repos suite comparing Everything looks good! |
Hey @ahejlsberg, the results of running the DT tests are ready. |
@typescript-bot cherry-pick this to release-5.1 |
Heya @DanielRosenwasser, I've started to run the task to cherry-pick this into |
Hey @DanielRosenwasser, I've opened #54413 for you. |
…e-5.1 (#54413) Co-authored-by: Anders Hejlsberg <[email protected]>
This PR fixes a defect in the logic introduced by #50070. Specifically, that logic wasn't properly handling type queries of the form
typeof this.xxx
.Fixes #54167.