File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed
ql/test/library-tests/TypeScript/RegressionTests/CyclicAlias Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -659,11 +659,16 @@ export class TypeTable {
659659 */
660660 public getSymbolId ( symbol : AugmentedSymbol ) : number {
661661 if ( symbol . flags & ts . SymbolFlags . Alias ) {
662- symbol = this . typeChecker . getAliasedSymbol ( symbol ) ;
662+ let aliasedSymbol : AugmentedSymbol = this . typeChecker . getAliasedSymbol ( symbol ) ;
663+ if ( aliasedSymbol . $id !== - 1 ) { // Check if aliased symbol is on-stack
664+ // Follow aliases eagerly, except in cases where this leads to cycles (for things like `import Foo = Foo.Bar`)
665+ symbol = aliasedSymbol ;
666+ }
663667 }
664668 // We cache the symbol ID to avoid rebuilding long symbol strings.
665669 let id = symbol . $id ;
666670 if ( id != null ) return id ;
671+ symbol . $id = - 1 ; // Mark as on-stack while we are computing the ID
667672 let content = this . getSymbolString ( symbol ) ;
668673 id = this . symbolIds . get ( content ) ;
669674 if ( id != null ) {
Original file line number Diff line number Diff line change 1+ | Success |
You can’t perform that action at this time.
0 commit comments