aboutsummaryrefslogblamecommitdiff
path: root/tests/neg/patmat.scala
blob: e2ab9874e34e06546601b9eee801c60b5277aa0f (plain) (tree)























                                                              
trait A
trait B
class C extends A with B
case class D()
object X {
  def unapply(x: B): Boolean = false
}

object Test {
  def main(args: Array[String]) = {
    val ca: A = new C
    ca match {
      case x: B =>
      case X() =>
      case D() => // error: neither a subtype not a supertype
    }
    val cc = new C
    cc match {
      case x: B =>
      case X() =>
      case D() =>  // error: neither a subtype not a supertype
    }
  }
}