Skip to content

Commit 517d7d9

Browse files
committed
do not make inferences with the same source\target pair multiple times
1 parent 6b05ad7 commit 517d7d9

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

src/compiler/checker.ts

Lines changed: 7 additions & 0 deletions
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 = [];

0 commit comments

Comments
 (0)