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

False positive exhaustivity warnings for a custom tuple class #12144

Open
dwijnand opened this issue Sep 7, 2020 · 0 comments
Open

False positive exhaustivity warnings for a custom tuple class #12144

dwijnand opened this issue Sep 7, 2020 · 0 comments
Labels
fixed in Scala 3 This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/) patmat
Milestone

Comments

@dwijnand
Copy link
Member

dwijnand commented Sep 7, 2020

Continuation of #10373, but for custom tuple classes.

Using Scala 2.13.3

abstract class Foo {
    def bar(): Unit = this match {
        case Foo_1() => //do something
        case Foo_2() => //do something
        // emits no warning
    }
    
    def blitz(that: Foo): Unit = T2(this, that) match {
        case T2(Foo_1(), _) => //do something
        case T2(Foo_2(), _) => //do something
        // emits "match may not be exhaustive"
    }
}
case class Foo_1() extends Foo
case class Foo_2() extends Foo

final case class T2[A, B](a: A, b: B)

Some analysis notes at scala/scala#9163 (comment).

@dwijnand dwijnand added the patmat label Sep 7, 2020
@dwijnand dwijnand added this to the Backlog milestone Oct 8, 2020
@SethTisue SethTisue added the fixed in Scala 3 This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/) label Jan 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fixed in Scala 3 This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/) patmat
Projects
None yet
Development

No branches or pull requests

2 participants