Skip to content

Commit f029ae2

Browse files
committed
Merge pull request #7163 from Microsoft/cachePairs
do not make inferences with the same source\target pair multiple times
2 parents 0436ba0 + 9611e67 commit f029ae2

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/compiler/checker.ts

+7
Original file line numberDiff line numberDiff line change
@@ -6524,6 +6524,7 @@ namespace ts {
65246524
let targetStack: Type[];
65256525
let depth = 0;
65266526
let inferiority = 0;
6527+
const visited: Map<boolean> = {};
65276528
inferFromTypes(source, target);
65286529

65296530
function isInProcess(source: Type, target: Type) {
@@ -6653,6 +6654,12 @@ namespace ts {
66536654
return;
66546655
}
66556656

6657+
const key = source.id + "," + target.id;
6658+
if (hasProperty(visited, key)) {
6659+
return;
6660+
}
6661+
visited[key] = true;
6662+
66566663
if (depth === 0) {
66576664
sourceStack = [];
66586665
targetStack = [];

src/server/protocol.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ declare namespace ts.server.protocol {
469469
placeOpenBraceOnNewLineForControlBlocks?: boolean;
470470

471471
/** Index operator */
472-
[key: string]: string | number | boolean;
472+
[key: string]: string | number | boolean;
473473
}
474474

475475
/**

0 commit comments

Comments
 (0)