-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Unreachable code warning for reachable match case #3543
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
Comments
@liufengyun any additional useful info |
Here are two more examples that should not emit warnings: class Test {
class Foo {
def unapply(x: String): Option[String] = ???
}
def test(xs: List[String]): Unit = {
val Yes = new Foo
val No = new Foo
xs match {
case Yes(x) :: ls => println("Yes")
case No(y) :: ls => println("No") // unreachable code
case _ =>
}
}
} class Test {
class Foo(x: Boolean) {
def unapply(y: String): Boolean = x
}
def test(xs: List[String]): Unit = {
val Yes = new Foo(true)
val No = new Foo(false)
xs match {
case No() :: ls => println("No")
case Yes() :: ls => println("Yes") // unreachable code
case _ =>
}
}
} |
liufengyun
added a commit
to dotty-staging/dotty
that referenced
this issue
Nov 23, 2017
liufengyun
added a commit
to dotty-staging/dotty
that referenced
this issue
Nov 23, 2017
nicolasstucki
pushed a commit
to dotty-staging/dotty
that referenced
this issue
Nov 24, 2017
nicolasstucki
added a commit
that referenced
this issue
Nov 24, 2017
Fix #3543: compare extractor with TermRef instead of MethodType
nerush
pushed a commit
to nerush/dotty
that referenced
this issue
Nov 28, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Emits the folowing warining but should not.
The code is correctly compiled and executed.
The text was updated successfully, but these errors were encountered: