Skip to content

Do match type reduction atPhaseNoLater than ElimOpaque - #20017

Merged
EugeneFlesselle merged 1 commit into
scala:mainfrom
dotty-staging:issues/i19434
Mar 27, 2024
Merged

EugeneFlesselle merged 1 commit into
scala:mainfrom
dotty-staging:issues/i19434

Conversation

@EugeneFlesselle

@EugeneFlesselle EugeneFlesselle commented Mar 26, 2024 •

Copy link
Copy Markdown
Contributor

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

@odersky odersky left a comment

Copy link
Copy Markdown
Contributor

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
@EugeneFlesselle
EugeneFlesselle deleted the issues/i19434 branch March 27, 2024 19:41
@dwijnand

Copy link
Copy Markdown
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