-
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
Fix for crash on call expression with private identifiers. #42861
Fix for crash on call expression with private identifiers. #42861
Conversation
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.
I'll do a cherry pick as soon as we're ready to merge. Looks good to me though.
…ing from an any typed variable. (GH microsoft#42860)
5d2e57e
to
21eb38b
Compare
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.
This looks OK to me, my minor lament aside. @sandersn has a bit more context here though.
const prop = getPropertyOfType(type, isPrivateIdentifier(name) ? getSymbolNameForPrivateIdentifier(type.symbol, name.escapedText) : name.escapedText); | ||
let prop: Symbol | undefined; | ||
if (isPrivateIdentifier(name)) { | ||
if (!type.symbol) { |
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.
Hm, I dislike relying on type.symbol
, but it seems like we can only guarantee getNodeLinks((<PropertyAccessExpression>node).expression).resolvedSymbol
exists for Identifier
LHSs, since as getTypeOfDottedName
recurs, it doesn't set it on other interesting LHS node kinds, like checkPropertyAccessExpressionOrQualifiedName
sometimes does.
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.
I initially had an isAnyLike
check since I discovered the issue on any
, but never
and unknown
also trigger the issue.
@typescript-bot cherry-pick this to release-4.2 |
Heya @RyanCavanaugh, I've started to run the task to cherry-pick this into |
Component commits: 21eb38b Fix for crash when using ca call expression on private identifier coming from an any typed variable. (GH microsoft#42860)
Hey @RyanCavanaugh, I've opened #42867 for you. |
Component commits: 21eb38b Fix for crash when using ca call expression on private identifier coming from an any typed variable. (GH #42860) Co-authored-by: Titian Cernicova-Dragomir <[email protected]>
Fix for crash when using ca call expression on private identifier coming from an any typed variable.
Fixes #42860