diff options
author | Lukas Rytz <lukas.rytz@gmail.com> | 2016-02-15 21:58:22 +0100 |
---|---|---|
committer | Lukas Rytz <lukas.rytz@gmail.com> | 2016-02-15 21:58:44 +0100 |
commit | ce3a8030fa59e5a9082528bf6f1ffc12a9277bc9 (patch) | |
tree | 28377cedd89b31d03c7d6132b5d8ec14580b4718 /test | |
parent | c524f18ee4959f6fe8297971fc882e63468c4317 (diff) | |
download | scala-ce3a8030fa59e5a9082528bf6f1ffc12a9277bc9.tar.gz scala-ce3a8030fa59e5a9082528bf6f1ffc12a9277bc9.tar.bz2 scala-ce3a8030fa59e5a9082528bf6f1ffc12a9277bc9.zip |
Rewrite a few more tests to the new optimizer
Diffstat (limited to 'test')
-rw-r--r-- | test/files/jvm/unreachable.check | 0 | ||||
-rw-r--r-- | test/files/jvm/unreachable/Foo_1.flags | 2 | ||||
-rw-r--r-- | test/files/neg/sealed-final-neg.flags | 2 | ||||
-rw-r--r-- | test/files/pos/SI-7060.flags | 1 | ||||
-rw-r--r-- | test/files/pos/SI-7060.scala | 11 | ||||
-rw-r--r-- | test/files/pos/inline-access-levels.flags | 2 | ||||
-rw-r--r-- | test/files/pos/t3234.flags | 2 | ||||
-rw-r--r-- | test/files/pos/t8315.flags | 1 | ||||
-rw-r--r-- | test/files/pos/t8315.scala | 12 | ||||
-rw-r--r-- | test/files/pos/t8315b.flags | 1 | ||||
-rw-r--r-- | test/files/pos/t8315b.scala | 11 | ||||
-rw-r--r-- | test/files/pos/t8410.flags | 2 | ||||
-rw-r--r-- | test/files/run/t2106.flags | 2 | ||||
-rw-r--r-- | test/files/run/t7817-tree-gen.flags | 1 | ||||
-rw-r--r-- | test/junit/scala/issues/OptimizedBytecodeTest.scala | 52 |
15 files changed, 58 insertions, 44 deletions
diff --git a/test/files/jvm/unreachable.check b/test/files/jvm/unreachable.check new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/test/files/jvm/unreachable.check diff --git a/test/files/jvm/unreachable/Foo_1.flags b/test/files/jvm/unreachable/Foo_1.flags index ce6e93b3da..ac9438e8d0 100644 --- a/test/files/jvm/unreachable/Foo_1.flags +++ b/test/files/jvm/unreachable/Foo_1.flags @@ -1 +1 @@ --Ynooptimise
\ No newline at end of file +-Yopt:l:default
\ No newline at end of file diff --git a/test/files/neg/sealed-final-neg.flags b/test/files/neg/sealed-final-neg.flags index 01bd79154a..673aca8931 100644 --- a/test/files/neg/sealed-final-neg.flags +++ b/test/files/neg/sealed-final-neg.flags @@ -1 +1 @@ --Xfatal-warnings -Yopt:l:project -Yinline-warnings
\ No newline at end of file +-Xfatal-warnings -Yopt:l:project -Yopt-warnings
\ No newline at end of file diff --git a/test/files/pos/SI-7060.flags b/test/files/pos/SI-7060.flags deleted file mode 100644 index c926ad6493..0000000000 --- a/test/files/pos/SI-7060.flags +++ /dev/null @@ -1 +0,0 @@ --Yinline -Ydead-code diff --git a/test/files/pos/SI-7060.scala b/test/files/pos/SI-7060.scala deleted file mode 100644 index c87620e020..0000000000 --- a/test/files/pos/SI-7060.scala +++ /dev/null @@ -1,11 +0,0 @@ -object Test { - - @inline final def mbarray_apply_minibox(array: Any, tag: Byte): Long = - if (tag == 0) { - array.asInstanceOf[Array[Long]](0) - } else - array.asInstanceOf[Array[Byte]](0).toLong - - def crash_method(): Unit = - mbarray_apply_minibox(null, 0) -} diff --git a/test/files/pos/inline-access-levels.flags b/test/files/pos/inline-access-levels.flags index d34387c651..9af9168a20 100644 --- a/test/files/pos/inline-access-levels.flags +++ b/test/files/pos/inline-access-levels.flags @@ -1 +1 @@ --Yopt:l:classpath -Xfatal-warnings -Yinline-warnings +-Yopt:l:classpath -Xfatal-warnings -Yopt-warnings diff --git a/test/files/pos/t3234.flags b/test/files/pos/t3234.flags index 78726f64f7..13878e00a9 100644 --- a/test/files/pos/t3234.flags +++ b/test/files/pos/t3234.flags @@ -1 +1 @@ --Yopt:l:project -Yinline-warnings -Xfatal-warnings +-Yopt:l:project -Yopt-warnings -Xfatal-warnings diff --git a/test/files/pos/t8315.flags b/test/files/pos/t8315.flags deleted file mode 100644 index c926ad6493..0000000000 --- a/test/files/pos/t8315.flags +++ /dev/null @@ -1 +0,0 @@ --Yinline -Ydead-code diff --git a/test/files/pos/t8315.scala b/test/files/pos/t8315.scala deleted file mode 100644 index 2f7742ed67..0000000000 --- a/test/files/pos/t8315.scala +++ /dev/null @@ -1,12 +0,0 @@ -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 deleted file mode 100644 index c926ad6493..0000000000 --- a/test/files/pos/t8315b.flags +++ /dev/null @@ -1 +0,0 @@ --Yinline -Ydead-code diff --git a/test/files/pos/t8315b.scala b/test/files/pos/t8315b.scala deleted file mode 100644 index d7a2bf565f..0000000000 --- a/test/files/pos/t8315b.scala +++ /dev/null @@ -1,11 +0,0 @@ -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); -} diff --git a/test/files/pos/t8410.flags b/test/files/pos/t8410.flags index 01fc9cd3ac..c3065096cf 100644 --- a/test/files/pos/t8410.flags +++ b/test/files/pos/t8410.flags @@ -1 +1 @@ --Yopt:l:project -Xfatal-warnings -deprecation:false -Yinline-warnings:false +-Yopt:l:project -Xfatal-warnings -deprecation:false -Yopt-warnings:none diff --git a/test/files/run/t2106.flags b/test/files/run/t2106.flags index 5d6ee831df..b0139685fa 100644 --- a/test/files/run/t2106.flags +++ b/test/files/run/t2106.flags @@ -1 +1 @@ --Yinline-warnings -Yopt:l:classpath +-Yopt-warnings -Yopt:l:classpath diff --git a/test/files/run/t7817-tree-gen.flags b/test/files/run/t7817-tree-gen.flags deleted file mode 100644 index ce6e93b3da..0000000000 --- a/test/files/run/t7817-tree-gen.flags +++ /dev/null @@ -1 +0,0 @@ --Ynooptimise
\ No newline at end of file diff --git a/test/junit/scala/issues/OptimizedBytecodeTest.scala b/test/junit/scala/issues/OptimizedBytecodeTest.scala index 3c6f1ff25e..58ab6c2134 100644 --- a/test/junit/scala/issues/OptimizedBytecodeTest.scala +++ b/test/junit/scala/issues/OptimizedBytecodeTest.scala @@ -328,4 +328,56 @@ class OptimizedBytecodeTest extends ClearAfterClass { assertInvoke(getSingleMethod(c, "f2a"), "C", "C$$$anonfun$3") assertInvoke(getSingleMethod(c, "f2b"), "C", "wrapper2") } + + @Test + def t7060(): Unit = { + val code = + """class C { + | @inline final def mbarray_apply_minibox(array: Any, tag: Byte): Long = + | if (tag == 0) array.asInstanceOf[Array[Long]](0) + | else array.asInstanceOf[Array[Byte]](0).toLong + | + | def t = mbarray_apply_minibox(null, 0) + |} + """.stripMargin + val List(c) = compileClasses(compiler)(code) + assertNoInvoke(getSingleMethod(c, "t")) + } + + @Test + def t8315(): Unit = { + val code = + """class C { + | def t(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 + """.stripMargin + val List(c, nil, nilMod, listt) = compileClasses(compiler)(code) + assertInvoke(getSingleMethod(c, "t"), "C", "C$$$anonfun$1") + } + + @Test + def t8315b(): Unit = { + val code = + """class C { + | 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) + |} + """.stripMargin + val List(c, f) = compileClasses(compiler)(code) + assertInvoke(getSingleMethod(c, "crash"), "C", "map") + } } |