diff options
Diffstat (limited to 'test/files/pos')
-rw-r--r-- | test/files/pos/inline-access-levels.flags | 2 | ||||
-rw-r--r-- | test/files/pos/inliner2.flags | 1 | ||||
-rw-r--r-- | test/files/pos/inliner2.scala | 57 | ||||
-rw-r--r-- | test/files/pos/sealed-final.flags | 1 | ||||
-rw-r--r-- | test/files/pos/sealed-final.scala | 14 | ||||
-rw-r--r-- | test/files/pos/t3234.flags | 1 | ||||
-rw-r--r-- | test/files/pos/t3234.scala | 17 | ||||
-rw-r--r-- | test/files/pos/t3420.flags | 2 | ||||
-rw-r--r-- | test/files/pos/t8410.flags | 2 |
9 files changed, 21 insertions, 76 deletions
diff --git a/test/files/pos/inline-access-levels.flags b/test/files/pos/inline-access-levels.flags index 9bda07eb6c..d34387c651 100644 --- a/test/files/pos/inline-access-levels.flags +++ b/test/files/pos/inline-access-levels.flags @@ -1 +1 @@ --optimise -Ybackend:GenASM -Xfatal-warnings -Yinline-warnings +-Yopt:l:classpath -Xfatal-warnings -Yinline-warnings diff --git a/test/files/pos/inliner2.flags b/test/files/pos/inliner2.flags deleted file mode 100644 index bff4bb8afa..0000000000 --- a/test/files/pos/inliner2.flags +++ /dev/null @@ -1 +0,0 @@ --optimise -Ybackend:GenASM -Xfatal-warnings
\ No newline at end of file diff --git a/test/files/pos/inliner2.scala b/test/files/pos/inliner2.scala deleted file mode 100644 index bc83e04312..0000000000 --- a/test/files/pos/inliner2.scala +++ /dev/null @@ -1,57 +0,0 @@ -// This isn't actually testing much, because no warning is emitted in versions -// before the fix which comes with this because the method isn't even considered -// for inlining due to the bug. -class A { - private var debug = false - @inline private def ifelse[T](cond: => Boolean, ifPart: => T, elsePart: => T): T = - if (cond) ifPart else elsePart - - final def bob1() = ifelse(debug, 1, 2) - final def bob2() = if (debug) 1 else 2 -} -// Cool: -// -// % ls -1 /tmp/2901/ -// A$$anonfun$bob1$1.class -// A$$anonfun$bob1$2.class -// A$$anonfun$bob1$3.class -// A.class -// % ls -1 /tmp/trunk -// A.class -// -// Observations: -// -// (1) The inlined version accesses the field: the explicit one calls the accessor. -// (2) The inlined version fails to eliminate boxing. With reference types it emits -// an unneeded checkcast. -// (3) The private var debug is mangled to A$$debug, but after inlining it is never accessed -// from outside of the class and doesn't need mangling. -// (4) We could forego emitting bytecode for ifelse entirely if it has been -// inlined at all sites. -// -// Generated bytecode for the above: -// -// public final int bob1(); -// Code: -// Stack=1, Locals=1, Args_size=1 -// 0: aload_0 -// 1: getfield #11; //Field A$$debug:Z -// 4: ifeq 14 -// 7: iconst_1 -// 8: invokestatic #41; //Method scala/runtime/BoxesRunTime.boxToInteger:(I)Ljava/lang/Integer; -// 11: goto 18 -// 14: iconst_2 -// 15: invokestatic #41; //Method scala/runtime/BoxesRunTime.boxToInteger:(I)Ljava/lang/Integer; -// 18: invokestatic #45; //Method scala/runtime/BoxesRunTime.unboxToInt:(Ljava/lang/Object;)I -// 21: ireturn -// -// public final int bob2(); -// Code: -// Stack=1, Locals=1, Args_size=1 -// 0: aload_0 -// 1: invokevirtual #48; //Method A$$debug:()Z -// 4: ifeq 11 -// 7: iconst_1 -// 8: goto 12 -// 11: iconst_2 -// 12: ireturn diff --git a/test/files/pos/sealed-final.flags b/test/files/pos/sealed-final.flags deleted file mode 100644 index 63f5e65527..0000000000 --- a/test/files/pos/sealed-final.flags +++ /dev/null @@ -1 +0,0 @@ --Xfatal-warnings -Yinline-warnings -Ybackend:GenASM -optimise
\ No newline at end of file diff --git a/test/files/pos/sealed-final.scala b/test/files/pos/sealed-final.scala deleted file mode 100644 index bdedb5c1f6..0000000000 --- a/test/files/pos/sealed-final.scala +++ /dev/null @@ -1,14 +0,0 @@ -sealed abstract class Foo { - @inline def bar(x: Int) = x + 1 -} -object Foo { - def mkFoo(): Foo = new Baz2 -} - -object Baz1 extends Foo -final class Baz2 extends Foo - -object Test { - // bar should be inlined now - def f = Foo.mkFoo() bar 10 -} diff --git a/test/files/pos/t3234.flags b/test/files/pos/t3234.flags new file mode 100644 index 0000000000..78726f64f7 --- /dev/null +++ b/test/files/pos/t3234.flags @@ -0,0 +1 @@ +-Yopt:l:project -Yinline-warnings -Xfatal-warnings diff --git a/test/files/pos/t3234.scala b/test/files/pos/t3234.scala new file mode 100644 index 0000000000..c3b7366db8 --- /dev/null +++ b/test/files/pos/t3234.scala @@ -0,0 +1,17 @@ +trait Trait1 { + @inline def foo2(n: Int) = n*n +} + +trait Trait2 { + @inline def foo3(n: Int) = 1 +} + +class Base extends Trait1 { + @inline def foo(n: Int) = n +} + +object Test extends Base with Trait2 { + def main(args: Array[String]) = { + println(foo(42) + foo2(11) + foo3(2)) + } +}
\ No newline at end of file diff --git a/test/files/pos/t3420.flags b/test/files/pos/t3420.flags index bff4bb8afa..4fbafb7e80 100644 --- a/test/files/pos/t3420.flags +++ b/test/files/pos/t3420.flags @@ -1 +1 @@ --optimise -Ybackend:GenASM -Xfatal-warnings
\ No newline at end of file +-Yopt-warnings Yopt:l:project -Xfatal-warnings
\ No newline at end of file diff --git a/test/files/pos/t8410.flags b/test/files/pos/t8410.flags index 2f32e3b26a..01fc9cd3ac 100644 --- a/test/files/pos/t8410.flags +++ b/test/files/pos/t8410.flags @@ -1 +1 @@ --optimise -Ybackend:GenASM -Xfatal-warnings -deprecation:false -Yinline-warnings:false +-Yopt:l:project -Xfatal-warnings -deprecation:false -Yinline-warnings:false |