@@ -10804,6 +10804,7 @@ namespace ts {
10804
10804
// very high likelihood we're dealing with an infinite generic type that perpetually generates
10805
10805
// new type identities as we descend into it. We stop the recursion here and mark this type
10806
10806
// and the outer types as having circular constraints.
10807
+ tracing.instant(tracing.Phase.Check, "getImmediateBaseConstraint_DepthLimit", { typeId: t.id, originalTypeId: type.id, depth: constraintDepth });
10807
10808
error(currentNode, Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite);
10808
10809
nonTerminating = true;
10809
10810
return t.immediateBaseConstraint = noConstraintType;
@@ -12878,6 +12879,7 @@ namespace ts {
12878
12879
// caps union types at 5000 unique literal types and 1000 unique object types.
12879
12880
const estimatedCount = (count / (len - i)) * len;
12880
12881
if (estimatedCount > (primitivesOnly ? 25000000 : 1000000)) {
12882
+ tracing.instant(tracing.Phase.Check, "removeSubtypes_DepthLimit", { typeIds: types.map(t => t.id) });
12881
12883
error(currentNode, Diagnostics.Expression_produces_a_union_type_that_is_too_complex_to_represent);
12882
12884
return false;
12883
12885
}
@@ -14940,6 +14942,7 @@ namespace ts {
14940
14942
// We have reached 50 recursive type instantiations and there is a very high likelyhood we're dealing
14941
14943
// with a combination of infinite generic types that perpetually generate new type identities. We stop
14942
14944
// the recursion here by yielding the error type.
14945
+ tracing.instant(tracing.Phase.Check, "instantiateType_DepthLimit", { typeId: type.id, instantiationDepth, instantiationCount });
14943
14946
error(currentNode, Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite);
14944
14947
return errorType;
14945
14948
}
@@ -16058,6 +16061,7 @@ namespace ts {
16058
16061
reportIncompatibleStack();
16059
16062
}
16060
16063
if (overflow) {
16064
+ tracing.instant(tracing.Phase.Check, "checkTypeRelatedTo_DepthLimit", { sourceId: source.id, targetId: target.id, depth });
16061
16065
const diag = error(errorNode || currentNode, Diagnostics.Excessive_stack_depth_comparing_types_0_and_1, typeToString(source), typeToString(target));
16062
16066
if (errorOutputContainer) {
16063
16067
(errorOutputContainer.errors || (errorOutputContainer.errors = [])).push(diag);
@@ -17358,6 +17362,7 @@ namespace ts {
17358
17362
numCombinations *= countTypes(getTypeOfSymbol(sourceProperty));
17359
17363
if (numCombinations > 25) {
17360
17364
// We've reached the complexity limit.
17365
+ tracing.instant(tracing.Phase.Check, "typeRelatedToDiscriminatedType_DepthLimit", { sourceId: source.id, targetId: target.id, numCombinations });
17361
17366
return Ternary.False;
17362
17367
}
17363
17368
}
@@ -18281,7 +18286,10 @@ namespace ts {
18281
18286
for (let i = 0; i < depth; i++) {
18282
18287
if (getRecursionIdentity(stack[i]) === identity) {
18283
18288
count++;
18284
- if (count >= 5) return true;
18289
+ if (count >= 5) {
18290
+ tracing.instant(tracing.Phase.Check, "isDeeplyNestedType_DepthLimit", { typeId: type.id, typeIdStack: stack.map(t => t.id), depth, count });
18291
+ return true;
18292
+ }
18285
18293
}
18286
18294
}
18287
18295
}
@@ -21089,6 +21097,7 @@ namespace ts {
21089
21097
if (flowDepth === 2000) {
21090
21098
// We have made 2000 recursive invocations. To avoid overflowing the call stack we report an error
21091
21099
// and disable further control flow analysis in the containing function or module body.
21100
+ tracing.instant(tracing.Phase.Check, "getTypeAtFlowNode_DepthLimit", { flowId: flow.id });
21092
21101
flowAnalysisDisabled = true;
21093
21102
reportFlowControlError(reference);
21094
21103
return errorType;
0 commit comments