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
Scala pattern match is not exhaustive on nested case classes #9630
Comments
Imported From: https://issues.scala-lang.org/browse/SI-9630?orig=1 |
sanjiv sahayam (sanjsmailbox-at-gmail.com) said: |
@retronym said (edited on Jan 25, 2016 9:26:50 AM UTC): Here's a slightly minimized version: sealed trait Base
final case class Base_1(sameName: Some[Any]) extends Base
final case class Base_2(sameName: Nested) extends Base
sealed trait Nested
final case class Nested_1(x: Any) extends Nested
final case class Nested_2(y: Any) extends Nested
class Test {
def test(b: Base): Unit = b match {
case Base_1(Some(_)) =>
case Base_2(Nested_1(_)) =>
case Base_2(Nested_2(_)) =>
}
}
|
@retronym said: I'll discuss this bug with @adriaanm to see if that's the right way forward. |
sanjiv sahayam (sanjsmailbox-at-gmail.com) said: It does seem weird that the name of a parameter would lead to this bug. |
@retronym said: See the additional test cases in https://github.com/scala/scala/compare/2.12.x...retronym:ticket/9630?expand=1 for more details. Thanks for your report, which triggered me to look at these again with fresh eyes. |
@retronym said: |
Hi,
I've got a case class hierarchy to encode some request and processing errors:
If I write a simple match across all patterns:
the compiler gives me a warning about missing match:
ProcessingError takes in a ProcessingErrorType with only two extensions: InvalidFormat and EntityNotFound, both which are accounted for in the pattern match.
The text was updated successfully, but these errors were encountered: