Skip to content
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

Reduce some match type in inlining to avoid opaque type headaches #20457

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

smarter
Copy link
Member

@smarter smarter commented May 22, 2024

The inliner tries to handle opaque types by replacing prefixes containing them by proxy objects with type aliases. When the type we're mapping is a match type application, this can end up breaking its reduction.

Reducing match type applications instead of performing this mapping seems to avoid the issue in practice, but I don't know if it completely solves the problem.

Fixes #20427.

The inliner tries to handle opaque types by replacing prefixes containing them
by proxy objects with type aliases. When the type we're mapping is a match type
application, this can end up breaking its reduction.

Reducing match type applications instead of performing this mapping seems to
avoid the issue in practice, but I don't know if it completely solves the
problem.

Fixes scala#20427.
EugeneFlesselle added a commit to dotty-staging/dotty that referenced this pull request Jul 1, 2024
Change the rhs of the added refinements from `TypeAlias`es to `RealTypeBounds`s.
This allows the opaque types to remain abstract type constructors,
which is necessary for the `MatchTypeCasePattern.AbstractTypeConstructor` logic.

In particular, an AppliedType where the tycon was a reference to the refinement,
used to dealias before proceeding with the comparison of the tycons,
which is a requirement of the aforementioned `AbstractTypeConstructor`
case of the MatchReducer.

Fixes scala#20427
Alternative to scala#20457
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.

NamedTuple selection on the result of NamedTuple.Concat doesn't work
2 participants