@@ -15418,21 +15418,21 @@ namespace ts {
15418
15418
// The result is undefined if the reference isn't a dotted name. We prefix nodes
15419
15419
// occurring in an apparent type position with '@' because the control flow type
15420
15420
// of such nodes may be based on the apparent type instead of the declared type.
15421
- function getFlowCacheKey(node: Node): string | undefined {
15421
+ function getFlowCacheKey(node: Node, declaredType: Type, initialType: Type, flowContainer: Node | undefined ): string | undefined {
15422
15422
switch (node.kind) {
15423
15423
case SyntaxKind.Identifier:
15424
15424
const symbol = getResolvedSymbol(<Identifier>node);
15425
- return symbol !== unknownSymbol ? ( isConstraintPosition(node) ? "@" : "") + getSymbolId(symbol) : undefined;
15425
+ return symbol !== unknownSymbol ? `${flowContainer ? getNodeId(flowContainer) : "-1"}|${getTypeId(declaredType)}|${getTypeId(initialType)}|${ isConstraintPosition(node) ? "@" : ""}${ getSymbolId(symbol)}` : undefined;
15426
15426
case SyntaxKind.ThisKeyword:
15427
15427
return "0";
15428
15428
case SyntaxKind.NonNullExpression:
15429
15429
case SyntaxKind.ParenthesizedExpression:
15430
- return getFlowCacheKey((<NonNullExpression | ParenthesizedExpression>node).expression);
15430
+ return getFlowCacheKey((<NonNullExpression | ParenthesizedExpression>node).expression, declaredType, initialType, flowContainer );
15431
15431
case SyntaxKind.PropertyAccessExpression:
15432
15432
case SyntaxKind.ElementAccessExpression:
15433
15433
const propName = getAccessedPropertyName(<AccessExpression>node);
15434
15434
if (propName !== undefined) {
15435
- const key = getFlowCacheKey((<AccessExpression>node).expression);
15435
+ const key = getFlowCacheKey((<AccessExpression>node).expression, declaredType, initialType, flowContainer );
15436
15436
return key && key + "." + propName;
15437
15437
}
15438
15438
}
@@ -16367,7 +16367,7 @@ namespace ts {
16367
16367
const id = getFlowNodeId(flow);
16368
16368
const cache = flowLoopCaches[id] || (flowLoopCaches[id] = createMap<Type>());
16369
16369
if (!key) {
16370
- key = getFlowCacheKey(reference);
16370
+ key = getFlowCacheKey(reference, declaredType, initialType, flowContainer );
16371
16371
// No cache key is generated when binding patterns are in unnarrowable situations
16372
16372
if (!key) {
16373
16373
return declaredType;
0 commit comments