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

Match type reduction fails, but works with minor tweaks #16869

Closed
KuceraMartin opened this issue Feb 9, 2023 · 3 comments · Fixed by #17065
Closed

Match type reduction fails, but works with minor tweaks #16869

KuceraMartin opened this issue Feb 9, 2023 · 3 comments · Fixed by #17065
Labels
area:match-types itype:bug regression This worked in a previous version but doesn't anymore
Milestone

Comments

@KuceraMartin
Copy link
Contributor

Compiler version

3.2.2

Minimized code

class C[T]

type Foo[T] = T match
  case C[true] => true
  case C[false] => false

class W[T] extends C[Foo[T]]

def f[T <: C[?]](t: T) = W[T]()

val b = C[true]()

f(b) : C[true]

https://scastie.scala-lang.org/MPU8IU46Q1GRYjcYu13S1g

Output

Compilation error:

Match type reduction failed since selector  T matches none of the cases
    case C[(true : Boolean)] => (true : Boolean)
    case C[(false : Boolean)] => (false : Boolean)

Expectation

The code should compile. In fact there are many small tweaks that make it compile. For example:

@KuceraMartin KuceraMartin added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label labels Feb 9, 2023
@mbovel mbovel added area:match-types and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels Feb 9, 2023
@Kordyjan Kordyjan added this to the Future versions milestone Feb 9, 2023
@scala-center-bot
Copy link

This issue was picked for the Issue Spree No. 27 of 07 March 2023 which takes place in a week from now. @dwijnand, @mbovel, @jan-pieter, @nmcb will be working on it. If you have any insight into the issue or guidance on how to fix it, please leave it here.

@Decel
Copy link
Contributor

Decel commented Mar 7, 2023

It's a regression, bisection seems to point to 5bf38d8

@prolativ prolativ added the regression This worked in a previous version but doesn't anymore label Mar 7, 2023
@dwijnand
Copy link
Member

dwijnand commented Mar 7, 2023

Also 509727a

@dwijnand dwijnand linked a pull request Mar 7, 2023 that will close this issue
@Kordyjan Kordyjan modified the milestones: Future versions, 3.3.1 Aug 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:match-types itype:bug regression This worked in a previous version but doesn't anymore
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants