We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
The code below (from https://github.com/paulp/scala/blob/e66bce29889365c74040a8bfe5d0b7cb89ccae6e/test/files/neg/unchecked.scala) should give an unreachability warning but doesn't. A scrutinee of type List[Cov[List[Int]]] is matched against type Seq[Cov[Seq[Any]]], which is a supertype; hence co1's body should ideally become simply true and an unreachability warning should be given.
List[Cov[List[Int]]]
Seq[Cov[Seq[Any]]]
co1
true
$ ~/opt/scala-2.10.0-M5/bin/scala -feature -unchecked -Xfatal-warnings [REPL greetings omitted] scala> class Cov[+T] { } defined class Cov scala> def co1(x: List[Cov[List[Int]]]) = x match { | case _: Seq[Cov[Seq[Any]]] => true // okay | case _ => false | } co1: (x: List[Cov[List[Int]]])Boolean scala> implicitly[List[Cov[List[Int]]] <:< Seq[Cov[Seq[Any]]]] res0: <:<[List[Cov[List[Int]]],Seq[Cov[Seq[Any]]]] = <function1>
The text was updated successfully, but these errors were encountered:
Imported From: https://issues.scala-lang.org/browse/SI-6152?orig=1 Reporter: @Blaisorblade Affected Versions: 2.10.0-M5
Sorry, something went wrong.
@Blaisorblade said: The second branch is indeed reachable.
scala> co1(null) res3: Boolean = false
Thanks to Paul Phillips for correcting me.
@paulp said: And I'm happy to note it DOES issue the unreachability warning if you throw in a "case null => " as well.
adriaanm
No branches or pull requests
The code below (from https://github.com/paulp/scala/blob/e66bce29889365c74040a8bfe5d0b7cb89ccae6e/test/files/neg/unchecked.scala) should give an unreachability warning but doesn't. A scrutinee of type
List[Cov[List[Int]]]
is matched against typeSeq[Cov[Seq[Any]]]
, which is a supertype; henceco1
's body should ideally become simplytrue
and an unreachability warning should be given.The text was updated successfully, but these errors were encountered: