Skip to content

No union subtype reduction during type inference #37327

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 11, 2020
Merged

No union subtype reduction during type inference #37327

merged 2 commits into from
Mar 11, 2020

Conversation

ahejlsberg
Copy link
Member

@ahejlsberg ahejlsberg commented Mar 10, 2020

One thing that immediately stands out in the stack trace for #31230 is that we're performing subtype reduction (removeSubtypes) on a union type during inference. We shouldn't be doing that, at least not without recursion limiters in place, because subtype reduction checks relations, which may perform inference, and off we go. It appears that removing the UnionReduction.Subtype flag where we construct a union type in getImplicitIndexTypeOfType fixes the issue.

Fixes #31230.

@ahejlsberg ahejlsberg requested review from weswigham and orta March 10, 2020 18:25
@ahejlsberg
Copy link
Member Author

@typescript-bot run dt
@typescript-bot test this
@typescript-bot user test this

@typescript-bot
Copy link
Collaborator

typescript-bot commented Mar 10, 2020

Heya @ahejlsberg, I've started to run the extended test suite on this PR at ef03050. You can monitor the build here.

@typescript-bot
Copy link
Collaborator

typescript-bot commented Mar 10, 2020

Heya @ahejlsberg, I've started to run the parallelized community code test suite on this PR at ef03050. You can monitor the build here.

@typescript-bot
Copy link
Collaborator

typescript-bot commented Mar 10, 2020

Heya @ahejlsberg, I've started to run the parallelized Definitely Typed test suite on this PR at ef03050. You can monitor the build here.

@typescript-bot
Copy link
Collaborator

The user suite test run you requested has finished and failed. I've opened a PR with the baseline diff from master.

Copy link
Contributor

@orta orta left a comment

Choose a reason for hiding this comment

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

Looks good, thanks for looking into it!

@ahejlsberg ahejlsberg merged commit b78ef30 into master Mar 11, 2020
@nodkz
Copy link

nodkz commented Mar 11, 2020

@ahejlsberg thanks a lot 🙏

@jakebailey jakebailey deleted the fix31230 branch November 7, 2022 17:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[TSC fails] RangeError: Maximum call stack size exceeded [with repro repo]
5 participants