Skip to content

Fixed a crash coming from hitting the instantiation depth limit#63136

Closed
Andarist wants to merge 1 commit intomicrosoft:mainfrom
Andarist:fix/crash-depth-limit
Closed

Fixed a crash coming from hitting the instantiation depth limit#63136
Andarist wants to merge 1 commit intomicrosoft:mainfrom
Andarist:fix/crash-depth-limit

Conversation

@Andarist
Copy link
Copy Markdown
Contributor

Since #61505 the compiler started to skip a lot of already performed instantiation work. Before the PR it would re-explore the same types over and over again and, in this case, it would eventually hit the instantiationCount limit. This results in a persistent situation in which further instantiations return errorType - given the instantiationCount never decrements (until it gets reset completely).

The situation with instantiationDepth is different, this one is decremented and further work happens. But it seems to me that every time we hit this - for either reason - it should be fine to "propagate" the errorType. Instantiation happens on types that are meant to be used one way or another and errorType propagate through all "operations" (like errorType[K] is errorType and so on). Perhaps it can change what happens with { a: errorType, b: Foo<T> } but given such object type will contain an errorType anyway... I think this is more than acceptable and this should allow the compiler to skip a bunch of redundant work.

fixes #62966

@typescript-bot
Copy link
Copy Markdown
Collaborator

With 6.0 out as the final release vehicle for this codebase, we're closing all PRs that don't fit the merge criteria for post-6.0 patches. If you think this was a mistake and this PR fits the post-6.0 patch criteria, please post to the 6.0 iteration issue with details (specifically, which PR and which patch criteria it satisfies).

Next steps for PRs:

  • For crash bugfixes or language service improvements, PRs are currently accepted at the typescript-go repo
  • Changes to type system behavior should wait until after 7.0, at which point mainline TypeScript development will resume in this repository with the Go codebase
  • Library file updates (lib.d.ts etc) continue to live in this repo or the DOM Generator repo as appropriate

@github-project-automation github-project-automation bot moved this from Not started to Done in PR Backlog Mar 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

For Backlog Bug PRs that fix a backlog bug

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Regression: RangeError: Maximum call stack size exceeded in type instantiation with recursive types and intersections

2 participants