Skip to content

Backport "Reduce projections of type aliases with class type prefixes" to LTS #21025

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 3 commits into from
Jul 5, 2024

Conversation

WojciechMazur
Copy link
Contributor

Backports #19931 to the LTS branch.

PR submitted by the release tooling.
[skip ci]

WojciechMazur and others added 3 commits July 4, 2024 19:01
Projections P # X are types that we would like to avoid. If X
is a class type, there's nothing we can do. If X is an abstract type,
we use skolemization and rewrite to (x?: P).X. If X is an alias
type we should simply dealias but this was not done before.

This caused an exonential blowup in #19892, where we costructed types
of the form

   ZPartialServerEndpoint[R, A, B, I, E, O, -C] # EndpointType[A, I, E, T, R] ... # EndpointType[A, I, E, T, R]

When the were 5 or more such selections, sompile times blew up (33s for 5, timeout after 5 minutes for 6).
I am still not qute sure where the blowup happened. Looking at stacktraces of random interrups
it seemed to be in a deep recursion of memberDenot and asSeenFrom calls.I believe it would still
be interesting to find out more about this, in case there are other similar situations where combinations
of deep projections with wide applications cannot be avoided.

But for this precise problem, eagerly dealising fixes it.

[Cherry-picked cd04d00][modified]
Base automatically changed from lts-20017 to lts-3.3 July 5, 2024 13:23
@WojciechMazur
Copy link
Contributor Author

No regressions detected in the community build up to lts-20295.

Reference

@WojciechMazur WojciechMazur merged commit 66753ca into lts-3.3 Jul 5, 2024
19 checks passed
@WojciechMazur WojciechMazur deleted the lts-19931 branch July 5, 2024 13:23
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.

2 participants