Skip to content

Commit 98ad12e

Browse files
committed
Remove union cache
1 parent b2b522e commit 98ad12e

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

src/compiler/checker.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -858,7 +858,6 @@ namespace ts {
858858
const flowLoopTypes: Type[][] = [];
859859
const sharedFlowNodes: FlowNode[] = [];
860860
const sharedFlowTypes: FlowType[] = [];
861-
const sharedFlowUnions: UnionType[] = [];
862861
const flowNodeReachable: (boolean | undefined)[] = [];
863862
const potentialThisCollisions: Node[] = [];
864863
const potentialNewTargetCollisions: Node[] = [];
@@ -18913,7 +18912,7 @@ namespace ts {
1891318912
for (let i = sharedFlowStart; i < sharedFlowCount; i++) {
1891418913
if (sharedFlowNodes[i] === flow) {
1891518914
flowDepth--;
18916-
containingUnion = sharedFlowUnions[i];
18915+
captureContainingUnion(flow, sharedFlowTypes[i]);
1891718916
return sharedFlowTypes[i];
1891818917
}
1891918918
}
@@ -18985,16 +18984,13 @@ namespace ts {
1898518984
// simply return the non-auto declared type to reduce follow-on errors.
1898618985
type = convertAutoToAny(declaredType);
1898718986
}
18988-
captureContainingUnion(flow, type);
1898918987
if (flags & FlowFlags.Shared) {
1899018988
// Record visited node and the associated type in the cache.
1899118989
sharedFlowNodes[sharedFlowCount] = flow;
1899218990
sharedFlowTypes[sharedFlowCount] = type;
18993-
if (containingUnion) {
18994-
sharedFlowUnions[sharedFlowCount] = containingUnion;
18995-
}
1899618991
sharedFlowCount++;
1899718992
}
18993+
captureContainingUnion(flow, type);
1899818994
flowDepth--;
1899918995
return type;
1900018996
}

tests/baselines/reference/discriminantsAndTypePredicates.symbols

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -761,9 +761,7 @@ function testComposition2(x: unknown) {
761761
>kind1 : Symbol(kind1, Decl(discriminantsAndTypePredicates.ts, 220, 46), Decl(discriminantsAndTypePredicates.ts, 221, 45), Decl(discriminantsAndTypePredicates.ts, 221, 68))
762762

763763
x.a; // Error
764-
>x.a : Symbol(a, Decl(discriminantsAndTypePredicates.ts, 220, 61), Decl(discriminantsAndTypePredicates.ts, 221, 57))
765764
>x : Symbol(x, Decl(discriminantsAndTypePredicates.ts, 243, 26))
766-
>a : Symbol(a, Decl(discriminantsAndTypePredicates.ts, 220, 61), Decl(discriminantsAndTypePredicates.ts, 221, 57))
767765
}
768766
}
769767
}

0 commit comments

Comments
 (0)