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

Inexhaustive match warning despite being exhaustive #15226

Closed
Swoorup opened this issue May 18, 2022 · 1 comment · Fixed by #15254
Closed

Inexhaustive match warning despite being exhaustive #15226

Swoorup opened this issue May 18, 2022 · 1 comment · Fixed by #15254

Comments

@Swoorup
Copy link

Swoorup commented May 18, 2022

Compiler version

3.1.3-RC2

Minimized code

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

Output

match may not be exhaustive.

It would fail on pattern case: ProjectionState(_1, _2)

Expectation

No warnings expected as match is complete?

@Swoorup Swoorup added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label labels May 18, 2022
@rmgk
Copy link

rmgk commented May 18, 2022

more minimized example

class Projection { type State = String }

sealed trait ProjectionState {
  val a: Projection
  val b: a.State
}

object ProjectionState {
  def apply(first: Projection, second: first.State): ProjectionState =
    new ProjectionState {
      override final val a: first.type = first
      override final val b: second.type = second
    }
  def unapply(pj: ProjectionState): Some[(pj.a.type, pj.b.type)] = Some(pj.a -> pj.b)
}

val projectionStates =
  ProjectionState(Projection(), "string") match {
    case ProjectionState(p, s) => ()
  }

@nicolasstucki nicolasstucki added itype:bug and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels May 19, 2022
@dwijnand dwijnand linked a pull request May 20, 2022 that will close this issue
@Kordyjan Kordyjan added this to the 3.2.0 milestone Aug 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants