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 {
659
659
*/
660
660
public getSymbolId ( symbol : AugmentedSymbol ) : number {
661
661
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
+ }
663
667
}
664
668
// We cache the symbol ID to avoid rebuilding long symbol strings.
665
669
let id = symbol . $id ;
666
670
if ( id != null ) return id ;
671
+ symbol . $id = - 1 ; // Mark as on-stack while we are computing the ID
667
672
let content = this . getSymbolString ( symbol ) ;
668
673
id = this . symbolIds . get ( content ) ;
669
674
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