summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/files/run/t4574.check2
-rw-r--r--test/files/run/t4574.scala13
2 files changed, 15 insertions, 0 deletions
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 } )
+ }
+}