From 3684d8cc681606d6c71ee8c40241ceba26bf9c0b Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Wed, 25 Oct 2023 14:46:34 -0700 Subject: [PATCH] Handle typeparameters as that will ensure we arent recording too many tracking symbols for recursive types --- src/compiler/checker.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index ac4641773c78b..384005e47acff 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -8877,7 +8877,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } if (context.trackedSymbols) { if (!oldContext.trackedSymbols) oldContext.trackedSymbols = context.trackedSymbols; - else oldContext.trackedSymbols.push(...context.trackedSymbols); + else Debug.assert(context.trackedSymbols === oldContext.trackedSymbols); } context = oldContext; } @@ -50423,12 +50423,13 @@ class SymbolTrackerImpl implements SymbolTracker { } trackSymbol(symbol: Symbol, enclosingDeclaration: Node | undefined, meaning: SymbolFlags): boolean { - (this.context.trackedSymbols ??= []).push([symbol, enclosingDeclaration, meaning]); if (this.inner?.trackSymbol && !this.disableTrackSymbol) { if (this.inner.trackSymbol(symbol, enclosingDeclaration, meaning)) { this.onDiagnosticReported(); return true; } + // Skip recording type parameters as they dont contribute to late painted statements + if (!(symbol.flags & SymbolFlags.TypeParameter)) (this.context.trackedSymbols ??= []).push([symbol, enclosingDeclaration, meaning]); } return false; }