Why doesn't the following produce a warning, when -unchecked is enabled:
object Order {
   sealed trait EntryOption
   case object EmptyEntry extends EntryOption
   trait Entry extends EntryOption
   def isEmpty(a: EntryOption): Boolean = a match {
      case EmptyEntry => true
//    case _: Entry   => false
   }
}
It seems I had exactly the same problem before in the days of Scala 2.8.0, with no sufficient answer.
EDIT
@Jed It doesn't make sense for me that the warning is only emitted for a non-abstract class Entry. Consider the following situation:
trait Order {
  sealed trait EntryOption
  case object EmptyEntry extends EntryOption
  abstract sealed class Entry extends EntryOption
  def isEmpty(a: EntryOption): Boolean = a match {
    case EmptyEntry => true
 // case _: Entry   => false
  }
}
trait OrderImpl extends Order {
  final class EntryImpl extends Entry
}
The only way to make the warning appear is to have a concrete class Entry in Order!
It does complain on trunk:
scala> object Order {
     |    sealed trait EntryOption
     |    case object EmptyEntry extends EntryOption
     |    trait Entry extends EntryOption
     | 
     |    def isEmpty( a: EntryOption ) : Boolean = a match {
     |       case EmptyEntry => true
     | //    case _: Entry   => false
     |    }
     | }
<console>:18: warning: match is not exhaustive!
missing combination          Entry
          def isEmpty( a: EntryOption ) : Boolean = a match {
                                                    ^
defined module Order
Entry is a trait, not a case class.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With