non-exhaustive match warning for abstract type

Jim Newsham <[email protected]>
Newsgroups gmane.comp.lang.scala
Message-ID <[email protected]>
Consider the following sample code:

    object SealedMatch {
      
      sealed trait A
      abstract class Abs extends A
      object B extends Abs
      object C extends Abs
      
      val value: A = ???
      
      value match {
        case B =>
        case C =>
      }
    
    }

Using Scala 2.11.5, the compiler produces the following warning on the line 
that begins with "value match":

    match may not be exhaustive. It would fail on the following input: Abs()

It would seem to me that since you can only match against concrete 
instances, the above pattern match is indeed exhaustive, and the compiler 
warning is a false positive.  Is this a compiler bug?

Thanks,
Jim

-- 
You received this message because you are subscribed to the Google Groups "scala-language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.