Skip to content
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

Avoid getting undefined callSignatures/constructSignatures in getPropertyOfType #42766

Merged
merged 1 commit into from
Feb 11, 2021

Conversation

elibarzilay
Copy link
Contributor

e350c35 (#40228) introduced a subtle bug: it switched the flags to an
alias, dropping SymbolFlags.Property --- and that makes
symbolIsValue() get to the resolveAlias(symbol) call, which leads to
getPropertyOfType() withresolved.callSignatures+constructSignatures
being undefined. So initialize them in setStructuredTypeMembers
before calling getNamedMembers().

Fixes #42350

@elibarzilay elibarzilay requested a review from sandersn February 11, 2021 21:04
@typescript-bot typescript-bot added Author: Team For Milestone Bug PRs that fix a bug with a specific milestone labels Feb 11, 2021
@sandersn
Copy link
Member

Looks like lots of failing tests from CI, so this fix may not be as simple as we thought it was.

…tPropertyOfType`

e350c35 (microsoft#40228) introduced a subtle bug: it switched the flags to an
alias, dropping `SymbolFlags.Property` --- and that makes
`symbolIsValue()` get to the `resolveAlias(symbol)` call, which leads to
`getPropertyOfType()` with`resolved.callSignatures`+`constructSignatures`
being `undefined`.  So initialize them in `setStructuredTypeMembers`
before calling `getNamedMembers()`.

Fixes microsoft#42350
@elibarzilay
Copy link
Contributor Author

Should be fixed now.

@elibarzilay elibarzilay merged commit c7bac6f into microsoft:master Feb 11, 2021
@elibarzilay elibarzilay deleted the 42350 branch February 11, 2021 23:56
@andrewbranch
Copy link
Member

This didn’t make it into 4.2. I’m assuming that was unintentional, since the bug was milestoned as 4.2.1? /cc @DanielRosenwasser

@typescript-bot cherry-pick this to release-4.2

@typescript-bot
Copy link
Collaborator

typescript-bot commented Feb 25, 2021

Heya @andrewbranch, I've started to run the task to cherry-pick this into release-4.2 on this PR at ed26816. You can monitor the build here.

@typescript-bot
Copy link
Collaborator

Hey @andrewbranch, I've opened #42950 for you.

typescript-bot pushed a commit to typescript-bot/TypeScript that referenced this pull request Feb 25, 2021
Component commits:
ed26816 Avoid getting undefined `callSignatures`/`constructSignatures` in `getPropertyOfType`
e350c35 (microsoft#40228) introduced a subtle bug: it switched the flags to an
alias, dropping `SymbolFlags.Property` --- and that makes
`symbolIsValue()` get to the `resolveAlias(symbol)` call, which leads to
`getPropertyOfType()` with`resolved.callSignatures`+`constructSignatures`
being `undefined`.  So initialize them in `setStructuredTypeMembers`
before calling `getNamedMembers()`.

Fixes microsoft#42350
RyanCavanaugh pushed a commit that referenced this pull request Feb 25, 2021
Component commits:
ed26816 Avoid getting undefined `callSignatures`/`constructSignatures` in `getPropertyOfType`
e350c35 (#40228) introduced a subtle bug: it switched the flags to an
alias, dropping `SymbolFlags.Property` --- and that makes
`symbolIsValue()` get to the `resolveAlias(symbol)` call, which leads to
`getPropertyOfType()` with`resolved.callSignatures`+`constructSignatures`
being `undefined`.  So initialize them in `setStructuredTypeMembers`
before calling `getNamedMembers()`.

Fixes #42350

Co-authored-by: Eli Barzilay <eli@barzilay.org>
This was referenced Mar 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Author: Team For Milestone Bug PRs that fix a bug with a specific milestone
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Compiler crash on exports.fn pattern
4 participants