summaryrefslogtreecommitdiff
path: root/test/pending/run/t4574.scala
blob: 1dde496aca0d1270dac86403d8d5e268a74ca1d7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
object Test {
  val xs: List[(Int, Int)] = List((2, 2), null)
  
  def expectMatchError[T](msg: String)(body: => T) {
    try { body ; assert(false, "Should not succeed.") }
    catch { case _: MatchError => println(msg) }
  }

  def main(args: Array[String]): Unit = {
    expectMatchError("I hereby refute null!")( for ((x, y) <- xs) yield x )
    expectMatchError("I denounce null as unListLike!")( (null: Any) match { case List(_*) => true } )
  }
}