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

Do match type reduction atPhaseNoLater than ElimOpaque #20017

Merged
merged 1 commit into from
Mar 27, 2024

Conversation

EugeneFlesselle
Copy link
Contributor

@EugeneFlesselle EugeneFlesselle commented Mar 26, 2024

If a match type pattern is an opaque type, we use its bounds when checking the validity of the pattern.
Following the ElimOpaque phase however, the pattern is beta-reduced (as normal applied type aliases), which may result in an illegal pattern, and hence an ErrorType.

We initially discussed doing the changes in the TypeComparer reduceMatchWith, but I think the atPhaseNoLater(elimOpaquePhase) should be in the reduced method of MatchType, for the footprint computation to happen in the same context.

Fixes #19434
Also allows to keep bad-footprint.scala in #19954

@EugeneFlesselle EugeneFlesselle changed the title [WIP] Do match type reduction atPhaseNoLater than ElimOpaque Do match type reduction atPhaseNoLater than ElimOpaque Mar 26, 2024
@EugeneFlesselle EugeneFlesselle marked this pull request as ready for review March 26, 2024 13:09
@EugeneFlesselle EugeneFlesselle requested a review from odersky March 26, 2024 13:46
@EugeneFlesselle EugeneFlesselle enabled auto-merge (rebase) March 26, 2024 13:49
Copy link
Contributor

@odersky odersky left a comment

Choose a reason for hiding this comment

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

That was easy, after all! LGTM

@EugeneFlesselle EugeneFlesselle merged commit 6a40dd5 into scala:main Mar 27, 2024
19 checks passed
@EugeneFlesselle EugeneFlesselle deleted the issues/i19434 branch March 27, 2024 19:41
@dwijnand
Copy link
Member

Nice fix

@Kordyjan Kordyjan added this to the 3.5.0 milestone May 10, 2024
WojciechMazur added a commit that referenced this pull request Jul 5, 2024
…LTS (#21023)

Backports #20017 to the LTS branch.

PR submitted by the release tooling.
[skip ci]
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.

Illegal MatchType Error reaches the backend
4 participants