Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/compiler/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23178,11 +23178,15 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
// in the process of computing variance information for recursive types and when
// comparing 'this' type arguments.
const varianceFlags = i < variances.length ? variances[i] : VarianceFlags.Covariant;
const s = sources[i];
const t = targets[i];
// Propagate variance reliability flags
if (varianceFlags & (VarianceFlags.Unmeasurable | VarianceFlags.Unreliable)) {
instantiateType(s, varianceFlags & VarianceFlags.Unmeasurable ? reportUnmeasurableMapper : reportUnreliableMapper);
}
const variance = varianceFlags & VarianceFlags.VarianceMask;
// We ignore arguments for independent type parameters (because they're never witnessed).
if (variance !== VarianceFlags.Independent) {
const s = sources[i];
const t = targets[i];
let related = Ternary.True;
if (varianceFlags & VarianceFlags.Unmeasurable) {
// Even an `Unmeasurable` variance works out without a structural check if the source and target are _identical_.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
//// [tests/cases/compiler/circularlySimplifyingConditionalTypesNoCrash.ts] ////

=== Performance Stats ===
Instantiation count: 1,000

=== circularlySimplifyingConditionalTypesNoCrash.ts ===
type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
>Omit : Omit<T, K>
Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/reference/deeplyNestedMappedTypes.types
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

=== Performance Stats ===
Type Count: 1,000
Copy link

Copilot AI Oct 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instantiation count increased from 5,000 to 25,000; please confirm this regression is intentional or add justification/mitigation (e.g. a note in the PR or follow-up optimization plan) since this may impact compile performance.

Suggested change
Type Count: 1,000
Type Count: 1,000
// NOTE: High instantiation count is intentional for this test case.
// This test is designed to stress-test recursive mapped types (see #55535).

Copilot uses AI. Check for mistakes.
Instantiation count: 5,000
Instantiation count: 25,000

=== deeplyNestedMappedTypes.ts ===
// Simplified repro from #55535
Expand Down