aboutsummaryrefslogtreecommitdiff
path: root/tests/pending/run/dead-code-elimination.scala
diff options
context:
space:
mode:
authorDmitry Petrashko <dmitry.petrashko@gmail.com>2015-05-12 18:30:53 +0200
committerDmitry Petrashko <dmitry.petrashko@gmail.com>2015-05-12 18:30:53 +0200
commit89bacb9c25a58454ff1878e67f7ea07ffc8c269f (patch)
tree51f1ff6c66aebe1b6109b1cffcc2bb8e4cf760a3 /tests/pending/run/dead-code-elimination.scala
parenta0fa33deafbea1bf53edc068c5ed9db5592822f9 (diff)
downloaddotty-89bacb9c25a58454ff1878e67f7ea07ffc8c269f.tar.gz
dotty-89bacb9c25a58454ff1878e67f7ea07ffc8c269f.tar.bz2
dotty-89bacb9c25a58454ff1878e67f7ea07ffc8c269f.zip
Run tests as they were in scala.
Diffstat (limited to 'tests/pending/run/dead-code-elimination.scala')
-rw-r--r--tests/pending/run/dead-code-elimination.scala33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/pending/run/dead-code-elimination.scala b/tests/pending/run/dead-code-elimination.scala
new file mode 100644
index 000000000..fd3f2a996
--- /dev/null
+++ b/tests/pending/run/dead-code-elimination.scala
@@ -0,0 +1,33 @@
+
+// This testcase is a snippet that did not compile correctly under
+// pre-release 2.10.x. The relevant discussion around it can be
+// found at:
+// https://groups.google.com/forum/?fromgroups#!topic/scala-internals/qcyTjk8euUI[1-25]
+//
+// The reason it did not compile is related to the fact that ICode
+// ops did not correctly define the stack entries they consumed and
+// the dead code elimination phase was unable to correctly reconstruct
+// the stack after code elimination.
+//
+// Originally, this did not compile, but I included it in the run
+// tests because this was ASM-dependand and did not happen for GenJVM.
+//
+// Thus, we run the code and force the loading of class B -- if the
+// bytecode is incorrect, it will fail the test.
+
+final class A {
+ def f1 = true
+ def f2 = true
+ @inline def f3 = f1 || f2
+ class B {
+ def f() = 1 to 10 foreach (_ => f3)
+ }
+ def f = (new B).f()
+}
+
+object Test {
+ def main(args: Array[String]): Unit = {
+ // force the loading of B
+ (new A).f
+ }
+}