@@ -10804,6 +10804,7 @@ namespace ts {
1080410804 // very high likelihood we're dealing with an infinite generic type that perpetually generates
1080510805 // new type identities as we descend into it. We stop the recursion here and mark this type
1080610806 // and the outer types as having circular constraints.
10807+ tracing.instant(tracing.Phase.Check, "getImmediateBaseConstraint_DepthLimit", { typeId: t.id, originalTypeId: type.id, depth: constraintDepth });
1080710808 error(currentNode, Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite);
1080810809 nonTerminating = true;
1080910810 return t.immediateBaseConstraint = noConstraintType;
@@ -12878,6 +12879,7 @@ namespace ts {
1287812879 // caps union types at 5000 unique literal types and 1000 unique object types.
1287912880 const estimatedCount = (count / (len - i)) * len;
1288012881 if (estimatedCount > (primitivesOnly ? 25000000 : 1000000)) {
12882+ tracing.instant(tracing.Phase.Check, "removeSubtypes_DepthLimit", { typeIds: types.map(t => t.id) });
1288112883 error(currentNode, Diagnostics.Expression_produces_a_union_type_that_is_too_complex_to_represent);
1288212884 return false;
1288312885 }
@@ -14940,6 +14942,7 @@ namespace ts {
1494014942 // We have reached 50 recursive type instantiations and there is a very high likelyhood we're dealing
1494114943 // with a combination of infinite generic types that perpetually generate new type identities. We stop
1494214944 // the recursion here by yielding the error type.
14945+ tracing.instant(tracing.Phase.Check, "instantiateType_DepthLimit", { typeId: type.id, instantiationDepth, instantiationCount });
1494314946 error(currentNode, Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite);
1494414947 return errorType;
1494514948 }
@@ -16058,6 +16061,7 @@ namespace ts {
1605816061 reportIncompatibleStack();
1605916062 }
1606016063 if (overflow) {
16064+ tracing.instant(tracing.Phase.Check, "checkTypeRelatedTo_DepthLimit", { sourceId: source.id, targetId: target.id, depth });
1606116065 const diag = error(errorNode || currentNode, Diagnostics.Excessive_stack_depth_comparing_types_0_and_1, typeToString(source), typeToString(target));
1606216066 if (errorOutputContainer) {
1606316067 (errorOutputContainer.errors || (errorOutputContainer.errors = [])).push(diag);
@@ -17358,6 +17362,7 @@ namespace ts {
1735817362 numCombinations *= countTypes(getTypeOfSymbol(sourceProperty));
1735917363 if (numCombinations > 25) {
1736017364 // We've reached the complexity limit.
17365+ tracing.instant(tracing.Phase.Check, "typeRelatedToDiscriminatedType_DepthLimit", { sourceId: source.id, targetId: target.id, numCombinations });
1736117366 return Ternary.False;
1736217367 }
1736317368 }
@@ -18281,7 +18286,10 @@ namespace ts {
1828118286 for (let i = 0; i < depth; i++) {
1828218287 if (getRecursionIdentity(stack[i]) === identity) {
1828318288 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+ }
1828518293 }
1828618294 }
1828718295 }
@@ -21089,6 +21097,7 @@ namespace ts {
2108921097 if (flowDepth === 2000) {
2109021098 // We have made 2000 recursive invocations. To avoid overflowing the call stack we report an error
2109121099 // and disable further control flow analysis in the containing function or module body.
21100+ tracing.instant(tracing.Phase.Check, "getTypeAtFlowNode_DepthLimit", { flowId: flow.id });
2109221101 flowAnalysisDisabled = true;
2109321102 reportFlowControlError(reference);
2109421103 return errorType;
0 commit comments