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

Dont look for properties of Object and Function type when looking to resolve named import from module with export= #37964

Merged
merged 6 commits into from
Nov 3, 2020

Conversation

sheetalkamat
Copy link
Member

Fixes #37165

@sheetalkamat
Copy link
Member Author

@typescript-bot test this

@typescript-bot
Copy link
Collaborator

typescript-bot commented Apr 14, 2020

Heya @sheetalkamat, I've started to run the extended test suite on this PR at 16b4153. You can monitor the build here.

@sheetalkamat
Copy link
Member Author

@typescript-bot user test this

@typescript-bot
Copy link
Collaborator

typescript-bot commented Apr 14, 2020

Heya @sheetalkamat, I've started to run the parallelized community code test suite on this PR at 16b4153. You can monitor the build here.

@sheetalkamat
Copy link
Member Author

@typescript-bot run dt

@typescript-bot
Copy link
Collaborator

typescript-bot commented Apr 14, 2020

Heya @sheetalkamat, I've started to run the parallelized Definitely Typed test suite on this PR at 16b4153. You can monitor the build here.

@sheetalkamat
Copy link
Member Author

@typescript-bot test this

@typescript-bot
Copy link
Collaborator

typescript-bot commented Apr 24, 2020

Heya @sheetalkamat, I've started to run the extended test suite on this PR at 5af482c. You can monitor the build here.

@sheetalkamat
Copy link
Member Author

@typescript-bot run dt
@typescript-bot test this
@typescript-bot user test this

@typescript-bot
Copy link
Collaborator

typescript-bot commented Apr 24, 2020

Heya @sheetalkamat, I've started to run the parallelized community code test suite on this PR at 5af482c. You can monitor the build here.

@typescript-bot
Copy link
Collaborator

typescript-bot commented Apr 24, 2020

Heya @sheetalkamat, I've started to run the parallelized Definitely Typed test suite on this PR at 5af482c. You can monitor the build here.

@typescript-bot
Copy link
Collaborator

typescript-bot commented Apr 24, 2020

Heya @sheetalkamat, I've started to run the extended test suite on this PR at 5af482c. You can monitor the build here.

@sandersn sandersn assigned weswigham and unassigned sheetalkamat May 5, 2020
@sandersn sandersn added the For Milestone Bug PRs that fix a bug with a specific milestone label May 5, 2020
src/compiler/checker.ts Outdated Show resolved Hide resolved
@@ -2586,7 +2586,7 @@ namespace ts {
let symbolFromVariable: Symbol | undefined;
// First check if module was specified with "export=". If so, get the member from the resolved type
if (moduleSymbol && moduleSymbol.exports && moduleSymbol.exports.get(InternalSymbolName.ExportEquals)) {
symbolFromVariable = getPropertyOfType(getTypeOfSymbol(targetSymbol), name.escapedText);
symbolFromVariable = getPropertyOfType(getTypeOfSymbol(targetSymbol), name.escapedText, /*skipObjectFunctionPropertyAugment*/ true);
Copy link
Member

@weswigham weswigham May 5, 2020

Choose a reason for hiding this comment

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

Actually, rather than threading through this flag, and worrying about the safety of caching it and have two differently calculated symbols for a property lookup, couldn't we

  1. Initialize globalFunctionType and globalObjectType each to a unique empty type (which should naturally cause property lookups that ultimately may have depended on them to fail during global initialization).
  2. Check if symbolFromVariable.parent here is globalObjectType or globalFunctionType and, if so, discard the result? (to ensure consistency with the initialization phase)

Copy link
Member Author

@sheetalkamat sheetalkamat Jul 25, 2020

Choose a reason for hiding this comment

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

  1. We want this to happen irrespective of augmenting that means any time we import the properties from object/function should be error so this might not happen at augmentation time.
  2. Will there be some kind of edge case where in valid scenario return globalfunctionType property symbol. That is what if getTypeOfSymbol(targetSymbol) is globalFunctionType or globalObjectType

@sheetalkamat
Copy link
Member Author

@typescript-bot run dt
@typescript-bot test this
@typescript-bot user test this

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jul 25, 2020

Heya @sheetalkamat, I've started to run the parallelized community code test suite on this PR at a252ef9. You can monitor the build here.

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jul 25, 2020

Heya @sheetalkamat, I've started to run the extended test suite on this PR at a252ef9. You can monitor the build here.

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jul 25, 2020

Heya @sheetalkamat, I've started to run the parallelized Definitely Typed test suite on this PR at a252ef9. You can monitor the build here.

@typescript-bot
Copy link
Collaborator

The user suite test run you requested has finished and failed. I've opened a PR with the baseline diff from master.

@sheetalkamat
Copy link
Member Author

@typescript-bot user test this

@typescript-bot
Copy link
Collaborator

typescript-bot commented Aug 3, 2020

Heya @sheetalkamat, I've started to run the parallelized community code test suite on this PR at a252ef9. You can monitor the build here.

@sheetalkamat
Copy link
Member Author

@typescript-bot run dt
@typescript-bot test this

@typescript-bot
Copy link
Collaborator

typescript-bot commented Aug 3, 2020

Heya @sheetalkamat, I've started to run the parallelized Definitely Typed test suite on this PR at a252ef9. You can monitor the build here.

@typescript-bot
Copy link
Collaborator

typescript-bot commented Aug 3, 2020

Heya @sheetalkamat, I've started to run the extended test suite on this PR at a252ef9. You can monitor the build here.

@sheetalkamat
Copy link
Member Author

All the tests passed.

@sandersn
Copy link
Member

@weswigham looking at your last review, it looks like @sheetalkamat addressed your questions. Is this ready to merge once 4.1 RC is out?

src/compiler/checker.ts Outdated Show resolved Hide resolved
@sheetalkamat
Copy link
Member Author

Will wait for master to become 4.2 before merging this one.

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
Archived in project
Development

Successfully merging this pull request may close these issues.

Cannot read property 'flags' of undefined
4 participants