scala icon indicating copy to clipboard operation
scala copied to clipboard

false positive "match may not be exhaustive" warning

Open xuwei-k opened this issue 7 years ago • 0 comments

scalaVersion := "2.12.2-bin-typelevel-4"

scalaOrganization := "org.typelevel"
object Test {
  def foo(a: Stream[Either[Int, String]]): Int = a match {
    case Right(_) #:: tail =>
      1
    case Left(_) #:: tail =>
      2
    case Stream.Empty =>
      3
  }
}
Test.scala:2: match may not be exhaustive.
[warn] It would fail on the following input: Cons()
[warn]   def foo(a: Stream[Either[Int, String]]): Int = a match {
[warn]                                                  ^
[warn] one warning found

xuwei-k avatar May 13 '17 10:05 xuwei-k