diff options
author | Paul Phillips <paulp@improving.org> | 2012-03-19 20:22:25 -0700 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2012-03-19 20:26:27 -0700 |
commit | fb44bb28b8b3e7861b96c874dc79072f89fec10b (patch) | |
tree | 51c7c0df0af089023346fb95f712274be6a01b30 /test/files/run | |
parent | 032b209125585011194e6195f1244b882b5b4d8f (diff) | |
download | scala-fb44bb28b8b3e7861b96c874dc79072f89fec10b.tar.gz scala-fb44bb28b8b3e7861b96c874dc79072f89fec10b.tar.bz2 scala-fb44bb28b8b3e7861b96c874dc79072f89fec10b.zip |
Test cases closes SI-4574.
Looks like I got that irrefutability bug too.
Diffstat (limited to 'test/files/run')
-rw-r--r-- | test/files/run/t4574.check | 2 | ||||
-rw-r--r-- | test/files/run/t4574.scala | 13 |
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 } ) + } +} |