Merge pull request #7163 from Microsoft/cachePairs

do not make inferences with the same source\target pair multiple times
This commit is contained in:
Vladimir Matveev
2016-02-22 11:50:52 -08:00
parent 243440ae14
commit e7f415d5e5
+7
View File
@@ -6446,6 +6446,7 @@ namespace ts {
let targetStack: Type[];
let depth = 0;
let inferiority = 0;
const visited: Map<boolean> = {};
inferFromTypes(source, target);
function isInProcess(source: Type, target: Type) {
@@ -6575,6 +6576,12 @@ namespace ts {
return;
}
const key = source.id + "," + target.id;
if (hasProperty(visited, key)) {
return;
}
visited[key] = true;
if (depth === 0) {
sourceStack = [];
targetStack = [];