From fcc63e2b667bdbaddbaacc843de97f8db02f6426 Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Tue, 20 Mar 2012 20:15:45 -0700 Subject: Restore irrefutability commits. This reverts commit d8ba5d091e5641553b438ef9930a6023a2709dcd. --- test/files/run/t4574.scala | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 test/files/run/t4574.scala (limited to 'test/files/run/t4574.scala') diff --git a/test/files/run/t4574.scala b/test/files/run/t4574.scala new file mode 100644 index 0000000000..1dde496aca --- /dev/null +++ b/test/files/run/t4574.scala @@ -0,0 +1,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 } ) + } +} -- cgit v1.2.3