1 2 3 4 5 6 7 8 9 10 11 12 13
class Test { val X: OnNext[Any] = null def Y: OnNext[Any] = null (null: Any) match { case X() => () // allowed case Y() => () // not allowed case OnNext[Any]() => () // should *not* be allowed, but was. } } class OnNext[+T] { def unapply(x: Any) = false }