Merge pull request #7621 from Microsoft/dropInferenceLimit

drop inference depth limit
This commit is contained in:
Vladimir Matveev
2016-03-21 15:36:36 -07:00
5 changed files with 347 additions and 6 deletions
-6
View File
@@ -6673,7 +6673,6 @@ namespace ts {
function inferTypes(context: InferenceContext, source: Type, target: Type) {
let sourceStack: Type[];
let targetStack: Type[];
const maxDepth = 5;
let depth = 0;
let inferiority = 0;
const visited: Map<boolean> = {};
@@ -6802,11 +6801,6 @@ namespace ts {
if (isInProcess(source, target)) {
return;
}
// we delibirately limit the depth we examine to infer types: this speeds up the overall inference process
// and user rarely expects inferences to be made from the deeply nested constituents.
if (depth > maxDepth) {
return;
}
if (isDeeplyNestedGeneric(source, sourceStack, depth) && isDeeplyNestedGeneric(target, targetStack, depth)) {
return;
}