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

Skip qualification check when symbol is already in the process of being qualified #21337

Merged
merged 1 commit into from
Jan 24, 2018

Conversation

weswigham
Copy link
Member

Fixes #21313

This is needed because 1. we were doing work we didn't need to do (if the symbol was found via the exports of an accessible symbol, it is accessible via it), and 2. unconditionally doing so fails when symbols are present in multiple containers (since symbol.parent only points at the original container, which can be inaccessible even if the symbol is accessible via another container).

@weswigham weswigham force-pushed the crazy-name-dependent-behavior branch from 08978ba to 2b52fbd Compare January 22, 2018 19:27
@weswigham weswigham requested review from mhegazy and sandersn January 22, 2018 19:27
Copy link
Member

@sandersn sandersn left a comment

Choose a reason for hiding this comment

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

Couple of early comments, although I suspect I’ll need an in-person explanation even after I have a chance to look at this in the editor.

@@ -2424,12 +2424,15 @@ namespace ts {
const visitedSymbolTables: SymbolTable[] = [];
return forEachSymbolTableInScope(enclosingDeclaration, getAccessibleSymbolChainFromSymbolTable);

function getAccessibleSymbolChainFromSymbolTable(symbols: SymbolTable): Symbol[] | undefined {
/**
* @param {ignoreQualification} boolean Set when a symbol is being looked for through the exports of another symbol (meaning we have a route to qualify it already)
Copy link
Member

Choose a reason for hiding this comment

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

No types in jsdoc!

Copy link
Member

Choose a reason for hiding this comment

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

How many calls are there to this function? Would it be horrible to make the new parameter required?

Copy link
Member Author

Choose a reason for hiding this comment

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

It must remain optional because it's usage other than the direct call where it is set is in the callback position for forEachSymbolTableInScope. We want to pass false there anyway, so we keep is optional to avoid changing forEachSymbolTableInScope or creating another closure.

@mhegazy
Copy link
Contributor

mhegazy commented Jan 24, 2018

@weswigham please port this change to release-2.7 as well.

@weswigham weswigham merged commit ba797f2 into microsoft:master Jan 24, 2018
@weswigham weswigham deleted the crazy-name-dependent-behavior branch January 24, 2018 20:37
weswigham added a commit to weswigham/TypeScript that referenced this pull request Jan 24, 2018
@weswigham
Copy link
Member Author

@mhegazy Opened #21393

weswigham added a commit that referenced this pull request Jan 25, 2018
@microsoft microsoft locked and limited conversation to collaborators Jul 3, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants