Skip to content

Commit 331e6ad

Browse files
committed
Properly cache shared flow node types
1 parent d163ab6 commit 331e6ad

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/compiler/checker.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21726,6 +21726,7 @@ namespace ts {
2172621726
return errorType;
2172721727
}
2172821728
flowDepth++;
21729+
let sharedFlow: FlowNode | undefined;
2172921730
while (true) {
2173021731
const flags = flow.flags;
2173121732
if (flags & FlowFlags.Shared) {
@@ -21738,6 +21739,7 @@ namespace ts {
2173821739
return sharedFlowTypes[i];
2173921740
}
2174021741
}
21742+
sharedFlow = flow;
2174121743
}
2174221744
let type: FlowType | undefined;
2174321745
if (flags & FlowFlags.Assignment) {
@@ -21801,9 +21803,9 @@ namespace ts {
2180121803
// simply return the non-auto declared type to reduce follow-on errors.
2180221804
type = convertAutoToAny(declaredType);
2180321805
}
21804-
if (flags & FlowFlags.Shared) {
21806+
if (sharedFlow) {
2180521807
// Record visited node and the associated type in the cache.
21806-
sharedFlowNodes[sharedFlowCount] = flow;
21808+
sharedFlowNodes[sharedFlowCount] = sharedFlow;
2180721809
sharedFlowTypes[sharedFlowCount] = type;
2180821810
sharedFlowCount++;
2180921811
}

0 commit comments

Comments
 (0)