summaryrefslogtreecommitdiff
path: root/test/files/run/bug4148.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2011-01-11 20:08:47 +0000
committerPaul Phillips <paulp@improving.org>2011-01-11 20:08:47 +0000
commit566fefb05abe31e90f765d1fb0a89b264302d9ce (patch)
tree28be1b3d6c4b862ff9a24b6dd665cbb8df1b68a9 /test/files/run/bug4148.scala
parent5f40fe0456238a8c58d05e58cd61a960f9a107a7 (diff)
downloadscala-566fefb05abe31e90f765d1fb0a89b264302d9ce.tar.gz
scala-566fefb05abe31e90f765d1fb0a89b264302d9ce.tar.bz2
scala-566fefb05abe31e90f765d1fb0a89b264302d9ce.zip
In r22807 an optimization was added to remove B...
In r22807 an optimization was added to remove Box(Unbox(x)) combinations. It turns out that without this in place, an expression like "x".asInstanceOf[Int] will no longer throw an exception. Refined the optimization. Closes #4148, review by dragos.
Diffstat (limited to 'test/files/run/bug4148.scala')
-rw-r--r--test/files/run/bug4148.scala9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/files/run/bug4148.scala b/test/files/run/bug4148.scala
new file mode 100644
index 0000000000..a7d181268d
--- /dev/null
+++ b/test/files/run/bug4148.scala
@@ -0,0 +1,9 @@
+object Test {
+ val x1 = try { "aaa".asInstanceOf[Int] } catch { case _ => "cce1" }
+ val x2 = try { (5: Any).asInstanceOf[Int] } catch { case _ => "cce2" }
+ val x3 = try { (new java.lang.Short(100.toShort).asInstanceOf[Int]) } catch { case _ => "cce3" }
+
+ def main(args: Array[String]): Unit = {
+ List(x1, x2, x3) foreach println
+ }
+}