summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2014-02-20 11:23:50 +0100
committerJason Zaugg <jzaugg@gmail.com>2014-02-20 11:31:35 +0100
commit64ed64ed5c2f64ee83a7963273bedf490926050e (patch)
treefc4db7f97fba020fe9d172c0a9a3af8ef4ef9e19 /test
parent0561dd084b5f3c2678eb032a40b85cb25bb6d589 (diff)
downloadscala-64ed64ed5c2f64ee83a7963273bedf490926050e.tar.gz
scala-64ed64ed5c2f64ee83a7963273bedf490926050e.tar.bz2
scala-64ed64ed5c2f64ee83a7963273bedf490926050e.zip
SI-8315 Fix crash in dead code elimination
It was a cache invalidation bug. We need to mark the Code as touched to invalidate the caches behind `predecessors` and `successors`.
Diffstat (limited to 'test')
-rw-r--r--test/files/pos/t8315.flags1
-rw-r--r--test/files/pos/t8315.scala12
-rw-r--r--test/files/pos/t8315b.flags1
-rw-r--r--test/files/pos/t8315b.scala11
4 files changed, 25 insertions, 0 deletions
diff --git a/test/files/pos/t8315.flags b/test/files/pos/t8315.flags
new file mode 100644
index 0000000000..c926ad6493
--- /dev/null
+++ b/test/files/pos/t8315.flags
@@ -0,0 +1 @@
+-Yinline -Ydead-code
diff --git a/test/files/pos/t8315.scala b/test/files/pos/t8315.scala
new file mode 100644
index 0000000000..2f7742ed67
--- /dev/null
+++ b/test/files/pos/t8315.scala
@@ -0,0 +1,12 @@
+object Test {
+ def crash(as: Listt): Unit = {
+ map(as, (_: Any) => return)
+ }
+
+ final def map(x: Listt, f: Any => Any): Any = {
+ if (x eq Nill) "" else f("")
+ }
+}
+
+object Nill extends Listt
+class Listt
diff --git a/test/files/pos/t8315b.flags b/test/files/pos/t8315b.flags
new file mode 100644
index 0000000000..c926ad6493
--- /dev/null
+++ b/test/files/pos/t8315b.flags
@@ -0,0 +1 @@
+-Yinline -Ydead-code
diff --git a/test/files/pos/t8315b.scala b/test/files/pos/t8315b.scala
new file mode 100644
index 0000000000..d7a2bf565f
--- /dev/null
+++ b/test/files/pos/t8315b.scala
@@ -0,0 +1,11 @@
+object Test extends Object {
+ def crash: Unit = {
+ val key = ""
+ try map(new F(key))
+ catch { case _: Throwable => }
+ };
+ final def map(f: F): Any = f.apply("");
+};
+final class F(key: String) {
+ final def apply(a: Any): Any = throw new RuntimeException(key);
+}