From fb44bb28b8b3e7861b96c874dc79072f89fec10b Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Mon, 19 Mar 2012 20:22:25 -0700 Subject: Test cases closes SI-4574. Looks like I got that irrefutability bug too. --- test/files/run/t4574.check | 2 ++ test/files/run/t4574.scala | 13 +++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 test/files/run/t4574.check create mode 100644 test/files/run/t4574.scala (limited to 'test') diff --git a/test/files/run/t4574.check b/test/files/run/t4574.check new file mode 100644 index 0000000000..a4522fff24 --- /dev/null +++ b/test/files/run/t4574.check @@ -0,0 +1,2 @@ +I hereby refute null! +I denounce null as unListLike! 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