diff options
Diffstat (limited to 'test')
154 files changed, 768 insertions, 392 deletions
diff --git a/test/disabled/presentation/akka/src/akka/actor/Supervisor.scala b/test/disabled/presentation/akka/src/akka/actor/Supervisor.scala index 4a1309faef..bec3c83f1a 100644 --- a/test/disabled/presentation/akka/src/akka/actor/Supervisor.scala +++ b/test/disabled/presentation/akka/src/akka/actor/Supervisor.scala @@ -95,7 +95,7 @@ case class SupervisorFactory(val config: SupervisorConfig) { * wire the children together using 'link', 'spawnLink' etc. and set the 'trapExit' flag in the * children that should trap error signals and trigger restart. * <p/> - * See the ScalaDoc for the SupervisorFactory for an example on how to declaratively wire up children. + * See the Scaladoc for the SupervisorFactory for an example on how to declaratively wire up children. * * @author <a href="http://jonasboner.com">Jonas Bonér</a> */ diff --git a/test/files/instrumented/inline-in-constructors.flags b/test/files/instrumented/inline-in-constructors.flags index d1ebc4c940..65caa3736e 100644 --- a/test/files/instrumented/inline-in-constructors.flags +++ b/test/files/instrumented/inline-in-constructors.flags @@ -1 +1 @@ --optimise -Ydelambdafy:inline -Ybackend:GenASM +-Yopt:l:classpath diff --git a/test/files/jvm/bytecode-test-example/Foo_1.flags b/test/files/jvm/bytecode-test-example/Foo_1.flags deleted file mode 100644 index 49f2d2c4c8..0000000000 --- a/test/files/jvm/bytecode-test-example/Foo_1.flags +++ /dev/null @@ -1 +0,0 @@ --Ybackend:GenASM diff --git a/test/files/jvm/constant-optimization/Foo_1.flags b/test/files/jvm/constant-optimization/Foo_1.flags deleted file mode 100644 index 67a1dbe8da..0000000000 --- a/test/files/jvm/constant-optimization/Foo_1.flags +++ /dev/null @@ -1 +0,0 @@ --Ynooptimise -Yconst-opt -Ybackend:GenASM
\ No newline at end of file diff --git a/test/files/jvm/nooptimise/Foo_1.flags b/test/files/jvm/nooptimise/Foo_1.flags deleted file mode 100644 index f493cf9f3f..0000000000 --- a/test/files/jvm/nooptimise/Foo_1.flags +++ /dev/null @@ -1 +0,0 @@ --Ybackend:GenASM -optimise -Ynooptimise
\ No newline at end of file diff --git a/test/files/jvm/nooptimise/Foo_1.scala b/test/files/jvm/nooptimise/Foo_1.scala deleted file mode 100644 index 896d5695de..0000000000 --- a/test/files/jvm/nooptimise/Foo_1.scala +++ /dev/null @@ -1,8 +0,0 @@ -class Foo_1 { - def foo() { - // optimization will remove this magic 3 from appearing in the source - // so -Ynooptimize should prevent that - val x = 3 - - } -} diff --git a/test/files/jvm/nooptimise/Test.scala b/test/files/jvm/nooptimise/Test.scala deleted file mode 100644 index 7b7ecd6dbd..0000000000 --- a/test/files/jvm/nooptimise/Test.scala +++ /dev/null @@ -1,23 +0,0 @@ -import scala.tools.partest.BytecodeTest -import scala.tools.asm -import asm.tree.InsnList -import scala.collection.JavaConverters._ - -object Test extends BytecodeTest { - def show: Unit = { - val classNode = loadClassNode("Foo_1") - val methodNode = getMethod(classNode, "foo") - // if optimization didn't run then - // there should be some useless instructions - // with the magic constant 3 - val expected = 1 - val got = countMagicThrees(methodNode.instructions) - assert(got == expected, s"expected $expected but got $got magic threes") - } - - def countMagicThrees(insnList: InsnList): Int = { - def isMagicThree(node: asm.tree.AbstractInsnNode): Boolean = - (node.getOpcode == asm.Opcodes.ICONST_3) - insnList.iterator.asScala.count(isMagicThree) - } -} diff --git a/test/files/jvm/patmat_opt_ignore_underscore.flags b/test/files/jvm/patmat_opt_ignore_underscore.flags deleted file mode 100644 index 2cd4b38726..0000000000 --- a/test/files/jvm/patmat_opt_ignore_underscore.flags +++ /dev/null @@ -1 +0,0 @@ --optimize -Ybackend:GenASM
\ No newline at end of file diff --git a/test/files/jvm/patmat_opt_no_nullcheck.flags b/test/files/jvm/patmat_opt_no_nullcheck.flags deleted file mode 100644 index 2cd4b38726..0000000000 --- a/test/files/jvm/patmat_opt_no_nullcheck.flags +++ /dev/null @@ -1 +0,0 @@ --optimize -Ybackend:GenASM
\ No newline at end of file diff --git a/test/files/jvm/patmat_opt_no_nullcheck/test.scala b/test/files/jvm/patmat_opt_no_nullcheck/test.scala deleted file mode 100644 index d02c929e01..0000000000 --- a/test/files/jvm/patmat_opt_no_nullcheck/test.scala +++ /dev/null @@ -1,11 +0,0 @@ -/* - * filter: inliner warning; re-run with - */ -import scala.tools.partest.BytecodeTest - -object Test extends BytecodeTest { - def show: Unit = { - val classNode = loadClassNode("SameBytecode") - sameBytecode(getMethod(classNode, "a"), getMethod(classNode, "b")) - } -} diff --git a/test/files/jvm/patmat_opt_primitive_typetest.flags b/test/files/jvm/patmat_opt_primitive_typetest.flags deleted file mode 100644 index b9bb09167e..0000000000 --- a/test/files/jvm/patmat_opt_primitive_typetest.flags +++ /dev/null @@ -1 +0,0 @@ --optimize -Ybackend:GenASM diff --git a/test/files/jvm/t7006/Foo_1.flags b/test/files/jvm/t7006/Foo_1.flags deleted file mode 100644 index 29a9d424f0..0000000000 --- a/test/files/jvm/t7006/Foo_1.flags +++ /dev/null @@ -1 +0,0 @@ --optimise -Ydebug -Xfatal-warnings -Ybackend:GenASM diff --git a/test/files/neg/case-collision.check b/test/files/neg/case-collision.check index 22cf105a4f..7360833a7d 100644 --- a/test/files/neg/case-collision.check +++ b/test/files/neg/case-collision.check @@ -1,12 +1,12 @@ case-collision.scala:5: warning: Class foo.BIPPY differs only in case from foo.Bippy. Such classes will overwrite one another on case-insensitive filesystems. class BIPPY ^ -case-collision.scala:11: warning: Class foo.HyRaX$ differs only in case from foo.Hyrax$. Such classes will overwrite one another on case-insensitive filesystems. -object HyRaX - ^ case-collision.scala:8: warning: Class foo.DINGO$ differs only in case from foo.Dingo$. Such classes will overwrite one another on case-insensitive filesystems. object DINGO ^ +case-collision.scala:11: warning: Class foo.HyRaX$ differs only in case from foo.Hyrax$. Such classes will overwrite one another on case-insensitive filesystems. +object HyRaX + ^ error: No warnings can be incurred under -Xfatal-warnings. three warnings found one error found diff --git a/test/files/neg/case-collision.flags b/test/files/neg/case-collision.flags index 14c1069dee..85d8eb2ba2 100644 --- a/test/files/neg/case-collision.flags +++ b/test/files/neg/case-collision.flags @@ -1 +1 @@ --Ybackend:GenASM -Xfatal-warnings +-Xfatal-warnings diff --git a/test/files/neg/depmet_1.check b/test/files/neg/depmet_1.check index 7a4f845fd5..15498568c5 100644 --- a/test/files/neg/depmet_1.check +++ b/test/files/neg/depmet_1.check @@ -1,7 +1,7 @@ -depmet_1.scala:2: error: illegal dependent method type: parameter appears in the type of another parameter in the same section or an earlier one +depmet_1.scala:2: error: illegal dependent method type: parameter may only be referenced in a subsequent parameter section def precise0(y: x.type)(x: String): Unit = {} ^ -depmet_1.scala:3: error: illegal dependent method type: parameter appears in the type of another parameter in the same section or an earlier one +depmet_1.scala:3: error: illegal dependent method type: parameter may only be referenced in a subsequent parameter section def precise1(x: String, y: x.type): Unit = {} ^ depmet_1.scala:4: error: not found: value y diff --git a/test/files/neg/macro-without-xmacros-a.check b/test/files/neg/macro-without-xmacros-a.check index ec194be3a9..65445d80dd 100644 --- a/test/files/neg/macro-without-xmacros-a.check +++ b/test/files/neg/macro-without-xmacros-a.check @@ -2,7 +2,7 @@ Macros_2.scala:5: error: macro definition needs to be enabled by making the implicit value scala.language.experimental.macros visible. This can be achieved by adding the import clause 'import scala.language.experimental.macros' or by setting the compiler option -language:experimental.macros. -See the Scala docs for value scala.language.experimental.macros for a discussion +See the Scaladoc for value scala.language.experimental.macros for a discussion why the feature needs to be explicitly enabled. def foo(x: Int): Int = macro foo_impl ^ diff --git a/test/files/neg/macro-without-xmacros-b.check b/test/files/neg/macro-without-xmacros-b.check index c97850f0a9..e3c1010d50 100644 --- a/test/files/neg/macro-without-xmacros-b.check +++ b/test/files/neg/macro-without-xmacros-b.check @@ -2,7 +2,7 @@ Macros_2.scala:3: error: macro definition needs to be enabled by making the implicit value scala.language.experimental.macros visible. This can be achieved by adding the import clause 'import scala.language.experimental.macros' or by setting the compiler option -language:experimental.macros. -See the Scala docs for value scala.language.experimental.macros for a discussion +See the Scaladoc for value scala.language.experimental.macros for a discussion why the feature needs to be explicitly enabled. def foo(x: Int): Int = macro Impls.foo_impl ^ diff --git a/test/files/neg/sealed-final-neg.check b/test/files/neg/sealed-final-neg.check index 500d23f49a..e135f38f8b 100644 --- a/test/files/neg/sealed-final-neg.check +++ b/test/files/neg/sealed-final-neg.check @@ -1,4 +1,9 @@ -sealed-final-neg.scala:41: error: expected class or object definition -"Due to SI-6142 this emits no warnings, so we'll just break it until that's fixed." -^ +sealed-final-neg.scala:17: warning: neg1/Foo::bar(I)I is annotated @inline but cannot be inlined: the method is not final and may be overridden. + def f = Foo.mkFoo() bar 10 + ^ +sealed-final-neg.scala:37: warning: neg2/Foo::bar(I)I is annotated @inline but cannot be inlined: the method is not final and may be overridden. + def f = Foo.mkFoo() bar 10 + ^ +error: No warnings can be incurred under -Xfatal-warnings. +two warnings found one error found diff --git a/test/files/neg/sealed-final-neg.flags b/test/files/neg/sealed-final-neg.flags index 3f0fcd2201..01bd79154a 100644 --- a/test/files/neg/sealed-final-neg.flags +++ b/test/files/neg/sealed-final-neg.flags @@ -1 +1 @@ --Xfatal-warnings -Ybackend:GenASM -Yinline-warnings -optimise
\ No newline at end of file +-Xfatal-warnings -Yopt:l:project -Yinline-warnings
\ No newline at end of file diff --git a/test/files/neg/sealed-final-neg.scala b/test/files/neg/sealed-final-neg.scala index bc25330e13..ec3b199819 100644 --- a/test/files/neg/sealed-final-neg.scala +++ b/test/files/neg/sealed-final-neg.scala @@ -37,5 +37,3 @@ package neg2 { def f = Foo.mkFoo() bar 10 } } - -"Due to SI-6142 this emits no warnings, so we'll just break it until that's fixed." diff --git a/test/files/neg/t3234.check b/test/files/neg/t3234.check deleted file mode 100644 index 8f0d624ed9..0000000000 --- a/test/files/neg/t3234.check +++ /dev/null @@ -1,6 +0,0 @@ -t3234.scala:17: warning: At the end of the day, could not inline @inline-marked method foo3 - println(foo(42) + foo2(11) + foo3(2)) - ^ -error: No warnings can be incurred under -Xfatal-warnings. -one warning found -one error found diff --git a/test/files/neg/t3234.flags b/test/files/neg/t3234.flags deleted file mode 100644 index 406231bd96..0000000000 --- a/test/files/neg/t3234.flags +++ /dev/null @@ -1 +0,0 @@ --Yinline -Yinline-warnings -Xfatal-warnings -Ybackend:GenASM diff --git a/test/files/neg/t6040.check b/test/files/neg/t6040.check index 16c90ede7e..350f796d18 100644 --- a/test/files/neg/t6040.check +++ b/test/files/neg/t6040.check @@ -2,7 +2,7 @@ t6040.scala:1: error: extension of type scala.Dynamic needs to be enabled by making the implicit value scala.language.dynamics visible. This can be achieved by adding the import clause 'import scala.language.dynamics' or by setting the compiler option -language:dynamics. -See the Scala docs for value scala.language.dynamics for a discussion +See the Scaladoc for value scala.language.dynamics for a discussion why the feature needs to be explicitly enabled. class X extends Dynamic ^ diff --git a/test/files/neg/t6120.check b/test/files/neg/t6120.check index a7d17e29cf..f432fde32f 100644 --- a/test/files/neg/t6120.check +++ b/test/files/neg/t6120.check @@ -2,7 +2,7 @@ t6120.scala:5: warning: postfix operator bippy should be enabled by making the implicit value scala.language.postfixOps visible. This can be achieved by adding the import clause 'import scala.language.postfixOps' or by setting the compiler option -language:postfixOps. -See the Scala docs for value scala.language.postfixOps for a discussion +See the Scaladoc for value scala.language.postfixOps for a discussion why the feature should be explicitly enabled. def f = null == null bippy ^ diff --git a/test/files/neg/t6446-additional.check b/test/files/neg/t6446-additional.check index a87af2f1e5..e56a67b28b 100644 --- a/test/files/neg/t6446-additional.check +++ b/test/files/neg/t6446-additional.check @@ -22,18 +22,6 @@ superaccessors 6 add super accessors in traits and nested classes mixin 20 mixin composition cleanup 21 platform-specific cleanups, generate reflective calls delambdafy 22 remove lambdas - icode 23 generate portable intermediate code -#partest -optimise - inliner 24 optimization: do inlining -inlinehandlers 25 optimization: inline exception handlers - closelim 26 optimization: eliminate uncalled closures - constopt 27 optimization: optimize null and other constants - dce 28 optimization: eliminate dead code - jvm 29 generate JVM bytecode - ploogin 30 A sample phase that does so many things it's kind of hard... - terminal 31 the last phase during a compilation run -#partest !-optimise - jvm 24 generate JVM bytecode - ploogin 25 A sample phase that does so many things it's kind of hard... - terminal 26 the last phase during a compilation run -#partest + jvm 23 generate JVM bytecode + ploogin 24 A sample phase that does so many things it's kind of hard... + terminal 25 the last phase during a compilation run diff --git a/test/files/neg/t6446-missing.check b/test/files/neg/t6446-missing.check index 029c8057c3..15f0ceb6e3 100644 --- a/test/files/neg/t6446-missing.check +++ b/test/files/neg/t6446-missing.check @@ -23,16 +23,5 @@ superaccessors 6 add super accessors in traits and nested classes mixin 20 mixin composition cleanup 21 platform-specific cleanups, generate reflective calls delambdafy 22 remove lambdas - icode 23 generate portable intermediate code -#partest !-optimise - jvm 24 generate JVM bytecode - terminal 25 the last phase during a compilation run -#partest -optimise - inliner 24 optimization: do inlining -inlinehandlers 25 optimization: inline exception handlers - closelim 26 optimization: eliminate uncalled closures - constopt 27 optimization: optimize null and other constants - dce 28 optimization: eliminate dead code - jvm 29 generate JVM bytecode - terminal 30 the last phase during a compilation run -#partest + jvm 23 generate JVM bytecode + terminal 24 the last phase during a compilation run diff --git a/test/files/neg/t6446-show-phases.check b/test/files/neg/t6446-show-phases.check index 3ae3f96ef2..280a4f43d5 100644 --- a/test/files/neg/t6446-show-phases.check +++ b/test/files/neg/t6446-show-phases.check @@ -22,16 +22,5 @@ superaccessors 6 add super accessors in traits and nested classes mixin 20 mixin composition cleanup 21 platform-specific cleanups, generate reflective calls delambdafy 22 remove lambdas - icode 23 generate portable intermediate code -#partest !-optimise - jvm 24 generate JVM bytecode - terminal 25 the last phase during a compilation run -#partest -optimise - inliner 24 optimization: do inlining -inlinehandlers 25 optimization: inline exception handlers - closelim 26 optimization: eliminate uncalled closures - constopt 27 optimization: optimize null and other constants - dce 28 optimization: eliminate dead code - jvm 29 generate JVM bytecode - terminal 30 the last phase during a compilation run -#partest + jvm 23 generate JVM bytecode + terminal 24 the last phase during a compilation run diff --git a/test/files/neg/t6952.check b/test/files/neg/t6952.check index 1a591d02c6..acee0e7d60 100644 --- a/test/files/neg/t6952.check +++ b/test/files/neg/t6952.check @@ -2,7 +2,7 @@ t6952.scala:2: error: extension of type scala.Dynamic needs to be enabled by making the implicit value scala.language.dynamics visible. This can be achieved by adding the import clause 'import scala.language.dynamics' or by setting the compiler option -language:dynamics. -See the Scala docs for value scala.language.dynamics for a discussion +See the Scaladoc for value scala.language.dynamics for a discussion why the feature needs to be explicitly enabled. trait B extends Dynamic ^ diff --git a/test/files/neg/t7494-no-options.check b/test/files/neg/t7494-no-options.check index e3316f590a..a4c4a1ad5b 100644 --- a/test/files/neg/t7494-no-options.check +++ b/test/files/neg/t7494-no-options.check @@ -23,18 +23,6 @@ superaccessors 6 add super accessors in traits and nested classes mixin 20 mixin composition cleanup 21 platform-specific cleanups, generate reflective calls delambdafy 22 remove lambdas - icode 23 generate portable intermediate code -#partest !-optimise - jvm 24 generate JVM bytecode - ploogin 25 A sample phase that does so many things it's kind of hard... - terminal 26 the last phase during a compilation run -#partest -optimise - inliner 24 optimization: do inlining -inlinehandlers 25 optimization: inline exception handlers - closelim 26 optimization: eliminate uncalled closures - constopt 27 optimization: optimize null and other constants - dce 28 optimization: eliminate dead code - jvm 29 generate JVM bytecode - ploogin 30 A sample phase that does so many things it's kind of hard... - terminal 31 the last phase during a compilation run -#partest + jvm 23 generate JVM bytecode + ploogin 24 A sample phase that does so many things it's kind of hard... + terminal 25 the last phase during a compilation run diff --git a/test/files/neg/t7622-cyclic-dependency/ThePlugin.scala b/test/files/neg/t7622-cyclic-dependency/ThePlugin.scala index 35c0ff8f53..0734863e64 100644 --- a/test/files/neg/t7622-cyclic-dependency/ThePlugin.scala +++ b/test/files/neg/t7622-cyclic-dependency/ThePlugin.scala @@ -26,7 +26,7 @@ class ThePlugin(val global: Global) extends Plugin { private object thePhase2 extends PluginComponent { val global = ThePlugin.this.global - val runsAfter = List[String]("dce","cyclicdependency1") + val runsAfter = List[String]("jvm","cyclicdependency1") val phaseName = ThePlugin.this.name + "2" diff --git a/test/files/neg/t8700a.check b/test/files/neg/t8700a.check new file mode 100644 index 0000000000..ce7945a3fc --- /dev/null +++ b/test/files/neg/t8700a.check @@ -0,0 +1,11 @@ +Bar.scala:2: warning: match may not be exhaustive. +It would fail on the following input: B + def bar1(foo: Foo) = foo match { + ^ +Bar.scala:6: warning: match may not be exhaustive. +It would fail on the following input: B + def bar2(foo: Baz) = foo match { + ^ +error: No warnings can be incurred under -Xfatal-warnings. +two warnings found +one error found diff --git a/test/files/neg/t8700a.flags b/test/files/neg/t8700a.flags new file mode 100644 index 0000000000..85d8eb2ba2 --- /dev/null +++ b/test/files/neg/t8700a.flags @@ -0,0 +1 @@ +-Xfatal-warnings diff --git a/test/files/neg/t8700a/Bar.scala b/test/files/neg/t8700a/Bar.scala new file mode 100644 index 0000000000..33ad8e9877 --- /dev/null +++ b/test/files/neg/t8700a/Bar.scala @@ -0,0 +1,9 @@ +object Bar { + def bar1(foo: Foo) = foo match { + case Foo.A => 1 + } + + def bar2(foo: Baz) = foo match { + case Baz.A => 1 + } +} diff --git a/test/files/neg/t8700a/Baz.java b/test/files/neg/t8700a/Baz.java new file mode 100644 index 0000000000..f85ad40802 --- /dev/null +++ b/test/files/neg/t8700a/Baz.java @@ -0,0 +1,11 @@ +public enum Baz { + A { + public void baz1() {} + }, + B { + public void baz1() {} + }; + + public abstract void baz1(); + public void baz2() {} +} diff --git a/test/files/neg/t8700a/Foo.java b/test/files/neg/t8700a/Foo.java new file mode 100644 index 0000000000..cc8e9daf1f --- /dev/null +++ b/test/files/neg/t8700a/Foo.java @@ -0,0 +1,4 @@ +public enum Foo { + A, + B +} diff --git a/test/files/neg/t8700b.check b/test/files/neg/t8700b.check new file mode 100644 index 0000000000..3bff78dd29 --- /dev/null +++ b/test/files/neg/t8700b.check @@ -0,0 +1,11 @@ +Bar_2.scala:2: warning: match may not be exhaustive. +It would fail on the following input: B + def bar1(foo: Foo_1) = foo match { + ^ +Bar_2.scala:6: warning: match may not be exhaustive. +It would fail on the following input: B + def bar2(foo: Baz_1) = foo match { + ^ +error: No warnings can be incurred under -Xfatal-warnings. +two warnings found +one error found diff --git a/test/files/neg/t8700b.flags b/test/files/neg/t8700b.flags new file mode 100644 index 0000000000..85d8eb2ba2 --- /dev/null +++ b/test/files/neg/t8700b.flags @@ -0,0 +1 @@ +-Xfatal-warnings diff --git a/test/files/neg/t8700b/Bar_2.scala b/test/files/neg/t8700b/Bar_2.scala new file mode 100644 index 0000000000..97ba16df27 --- /dev/null +++ b/test/files/neg/t8700b/Bar_2.scala @@ -0,0 +1,9 @@ +object Bar { + def bar1(foo: Foo_1) = foo match { + case Foo_1.A => 1 + } + + def bar2(foo: Baz_1) = foo match { + case Baz_1.A => 1 + } +} diff --git a/test/files/neg/t8700b/Baz_1.java b/test/files/neg/t8700b/Baz_1.java new file mode 100644 index 0000000000..6a057c2c9c --- /dev/null +++ b/test/files/neg/t8700b/Baz_1.java @@ -0,0 +1,11 @@ +public enum Baz_1 { + A { + public void baz1() {} + }, + B { + public void baz1() {} + }; + + public abstract void baz1(); + public void baz2() {} +} diff --git a/test/files/neg/t8700b/Foo_1.java b/test/files/neg/t8700b/Foo_1.java new file mode 100644 index 0000000000..22656bdedd --- /dev/null +++ b/test/files/neg/t8700b/Foo_1.java @@ -0,0 +1,4 @@ +public enum Foo_1 { + A, + B +} diff --git a/test/files/neg/t8736-c.check b/test/files/neg/t8736-c.check index 06b2228543..7debb6d515 100644 --- a/test/files/neg/t8736-c.check +++ b/test/files/neg/t8736-c.check @@ -2,7 +2,7 @@ t8736-c.scala:4: warning: higher-kinded type should be enabled by making the implicit value scala.language.higherKinds visible. This can be achieved by adding the import clause 'import scala.language.higherKinds' or by setting the compiler option -language:higherKinds. -See the Scala docs for value scala.language.higherKinds for a discussion +See the Scaladoc for value scala.language.higherKinds for a discussion why the feature should be explicitly enabled. def hk[M[_]] = ??? ^ diff --git a/test/files/pos/existental-slow-compile2.scala b/test/files/pos/existental-slow-compile2.scala new file mode 100644 index 0000000000..907344982c --- /dev/null +++ b/test/files/pos/existental-slow-compile2.scala @@ -0,0 +1,7 @@ +class C { + class L[+A] + def test = { + val foo: + L[_ <: L[_ <: L[_ <: L[_ <: L[_ <: L[_ <: _ <: L[_ <: L[_ <: L[_ <: L[_ <: L[_ <: L[_ <: L[_ <: L[_ <: L[_ <: L[_ <: L[_ <: L[_ <: _ <: L[_ <: L[_ <: L[_ <: L[_ <: L[_ <: L[_]]]]]]]]]]]]]]]]]]]]]]]] + = ??? } } + diff --git a/test/files/pos/existential-slow-compile1.flags b/test/files/pos/existential-slow-compile1.flags new file mode 100644 index 0000000000..7f7581974d --- /dev/null +++ b/test/files/pos/existential-slow-compile1.flags @@ -0,0 +1 @@ +-Ystop-after:refchecks diff --git a/test/files/pos/existential-slow-compile1.scala b/test/files/pos/existential-slow-compile1.scala new file mode 100644 index 0000000000..8602afd9db --- /dev/null +++ b/test/files/pos/existential-slow-compile1.scala @@ -0,0 +1,7 @@ +class C { + type L[+A] = scala.collection.immutable.List[A] + def test = { + val foo: + L[_ <: L[_ <: L[_ <: L[_ <: L[_ <: L[_ <: _ <: L[_ <: L[_ <: L[_ <: L[_ <: L[_ <: L[_ <: L[_ <: L[_ <: L[_ <: L[_ <: L[_ <: L[_ <: _ <: L[_ <: L[_ <: L[_ <: L[_ <: L[_ <: L[_]]]]]]]]]]]]]]]]]]]]]]]] + = ??? } } + 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/native-warning.scala b/test/files/pos/native-warning.scala index f721a57e8f..a2918c11b5 100644 --- a/test/files/pos/native-warning.scala +++ b/test/files/pos/native-warning.scala @@ -1,3 +1,7 @@ class A { @native def setup(): Unit + + // also kosher + @native private def f(): Unit + @native final def g(): Unit } 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/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/neg/t3234.scala b/test/files/pos/t3234.scala index 1553f1fa05..c3b7366db8 100644 --- a/test/files/neg/t3234.scala +++ b/test/files/pos/t3234.scala @@ -1,7 +1,5 @@ trait Trait1 { - // need more work before this one works - // @inline - def foo2(n: Int) = n*n + @inline def foo2(n: Int) = n*n } trait Trait2 { 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 diff --git a/test/files/pos/t9178.flags b/test/files/pos/t9178.flags new file mode 100644 index 0000000000..7de3c0f3ee --- /dev/null +++ b/test/files/pos/t9178.flags @@ -0,0 +1 @@ +-Xfatal-warnings -deprecation diff --git a/test/files/pos/t9178.scala b/test/files/pos/t9178.scala new file mode 100644 index 0000000000..f2cf20a778 --- /dev/null +++ b/test/files/pos/t9178.scala @@ -0,0 +1,13 @@ +// eta expansion to Function0 is problematic (as shown here). +// Perhaps we should we deprecate it? See discussion in the comments of +// on SI-9178. +// +// This test encodes the status quo: no deprecation. +object Test { + def foo(): () => String = () => "" + val f: () => Any = foo + + def main(args: Array[String]): Unit = { + println(f()) // <function0> + } +} diff --git a/test/files/pos/t9178b.flags b/test/files/pos/t9178b.flags new file mode 100644 index 0000000000..48fd867160 --- /dev/null +++ b/test/files/pos/t9178b.flags @@ -0,0 +1 @@ +-Xexperimental diff --git a/test/files/pos/t9178b.scala b/test/files/pos/t9178b.scala new file mode 100644 index 0000000000..cbeaed4f17 --- /dev/null +++ b/test/files/pos/t9178b.scala @@ -0,0 +1,7 @@ +abstract class Test{ + val writeInput: java.io.OutputStream => Unit + def getOutputStream(): java.io.OutputStream + + writeInput(getOutputStream) +} + diff --git a/test/files/run/constant-optimization.flags b/test/files/run/constant-optimization.flags deleted file mode 100644 index 6c9965e749..0000000000 --- a/test/files/run/constant-optimization.flags +++ /dev/null @@ -1 +0,0 @@ --optimise -Ybackend:GenASM diff --git a/test/files/run/dead-code-elimination.flags b/test/files/run/dead-code-elimination.flags deleted file mode 100644 index b9bb09167e..0000000000 --- a/test/files/run/dead-code-elimination.flags +++ /dev/null @@ -1 +0,0 @@ --optimize -Ybackend:GenASM diff --git a/test/files/run/delambdafy-specialized.check b/test/files/run/delambdafy-specialized.check deleted file mode 100644 index c6903b9e29..0000000000 --- a/test/files/run/delambdafy-specialized.check +++ /dev/null @@ -1 +0,0 @@ -scala.runtime.AbstractFunction1$mcII$sp diff --git a/test/files/run/delambdafy-specialized.flags b/test/files/run/delambdafy-specialized.flags deleted file mode 100644 index d6278aa940..0000000000 --- a/test/files/run/delambdafy-specialized.flags +++ /dev/null @@ -1 +0,0 @@ --Ydelambdafy:method -Ybackend:GenASM diff --git a/test/files/run/delambdafy-specialized.scala b/test/files/run/delambdafy-specialized.scala deleted file mode 100644 index 634d4e490b..0000000000 --- a/test/files/run/delambdafy-specialized.scala +++ /dev/null @@ -1,6 +0,0 @@ -object Test { - def main(args: Array[String]): Unit = { - val f = (x: Int) => -x - println(f.getClass.getSuperclass.getName) - } -} diff --git a/test/files/run/delambdafy_t6028.check b/test/files/run/delambdafy_t6028.check index 885fc3c9f3..c8c4b1cb4c 100644 --- a/test/files/run/delambdafy_t6028.check +++ b/test/files/run/delambdafy_t6028.check @@ -38,10 +38,18 @@ package <empty> { <synthetic> <stable> <artifact> def $outer(): T = MethodLocalObject$2.this.$outer; <synthetic> <stable> <artifact> def $outer(): T = MethodLocalObject$2.this.$outer }; - final <stable> private[this] def MethodLocalObject$1(barParam$1: String, MethodLocalObject$module$1: runtime.VolatileObjectRef): T#MethodLocalObject$2.type = { - MethodLocalObject$module$1.elem = new T#MethodLocalObject$2.type(T.this, barParam$1); + final <stable> private[this] def MethodLocalObject$lzycompute$1(barParam$1: String, MethodLocalObject$module$1: runtime.VolatileObjectRef): T#MethodLocalObject$2.type = { + T.this.synchronized({ + if (MethodLocalObject$module$1.elem.$asInstanceOf[T#MethodLocalObject$2.type]().eq(null)) + MethodLocalObject$module$1.elem = new T#MethodLocalObject$2.type(T.this, barParam$1); + scala.runtime.BoxedUnit.UNIT + }); MethodLocalObject$module$1.elem.$asInstanceOf[T#MethodLocalObject$2.type]() }; + final <stable> private[this] def MethodLocalObject$1(barParam$1: String, MethodLocalObject$module$1: runtime.VolatileObjectRef): T#MethodLocalObject$2.type = if (MethodLocalObject$module$1.elem.$asInstanceOf[T#MethodLocalObject$2.type]().eq(null)) + T.this.MethodLocalObject$lzycompute$1(barParam$1, MethodLocalObject$module$1) + else + MethodLocalObject$module$1.elem.$asInstanceOf[T#MethodLocalObject$2.type](); abstract trait MethodLocalTrait$1$class extends Object with T#MethodLocalTrait$1 { def /*MethodLocalTrait$1$class*/$init$(barParam$1: String): Unit = { () diff --git a/test/files/run/elidable-opt.flags b/test/files/run/elidable-opt.flags index 6537d2f57a..93fd3d5317 100644 --- a/test/files/run/elidable-opt.flags +++ b/test/files/run/elidable-opt.flags @@ -1 +1 @@ --optimise -Ybackend:GenASM -Xelide-below 900 +-Xelide-below 900 diff --git a/test/files/run/finalvar.flags b/test/files/run/finalvar.flags index 8d9be3d62e..a8c7600a03 100644 --- a/test/files/run/finalvar.flags +++ b/test/files/run/finalvar.flags @@ -1 +1 @@ --Yoverride-vars -Yinline -Ybackend:GenASM
\ No newline at end of file +-Yoverride-vars -Yopt:l:project
\ No newline at end of file diff --git a/test/files/run/icode-reader-dead-code.scala b/test/files/run/icode-reader-dead-code.scala index 535ef2a2e2..df31219dd5 100644 --- a/test/files/run/icode-reader-dead-code.scala +++ b/test/files/run/icode-reader-dead-code.scala @@ -36,7 +36,7 @@ object Test extends DirectTest { // If inlining fails, the compiler will issue an inliner warning that is not present in the // check file - compileString(newCompiler("-usejavacp", "-optimise", "-Ybackend:GenASM"))(bCode) + compileString(newCompiler("-usejavacp", "-Yopt:l:classpath"))(bCode) } def readClass(file: String) = { diff --git a/test/files/run/optimizer-array-load.flags b/test/files/run/optimizer-array-load.flags deleted file mode 100644 index 99bd6c895d..0000000000 --- a/test/files/run/optimizer-array-load.flags +++ /dev/null @@ -1 +0,0 @@ --optimise -Ybackend:GenASM
\ No newline at end of file diff --git a/test/files/run/programmatic-main.check b/test/files/run/programmatic-main.check index 1cd94ccb45..280a4f43d5 100644 --- a/test/files/run/programmatic-main.check +++ b/test/files/run/programmatic-main.check @@ -22,6 +22,5 @@ superaccessors 6 add super accessors in traits and nested classes mixin 20 mixin composition cleanup 21 platform-specific cleanups, generate reflective calls delambdafy 22 remove lambdas - icode 23 generate portable intermediate code - jvm 24 generate JVM bytecode - terminal 25 the last phase during a compilation run + jvm 23 generate JVM bytecode + terminal 24 the last phase during a compilation run diff --git a/test/files/run/sbt-icode-interface.scala b/test/files/run/sbt-icode-interface.scala index 84d38cc65a..7cd2de5c00 100644 --- a/test/files/run/sbt-icode-interface.scala +++ b/test/files/run/sbt-icode-interface.scala @@ -9,34 +9,32 @@ object Test extends DirectTest { """.trim def show() { - for (b <- List("GenASM", "GenBCode")) { - val global = newCompiler("-usejavacp", s"-Ybackend:$b") - import global._ - val r = new Run - r.compileSources(newSourceFile(code) :: Nil) - - val results = collection.mutable.Buffer[(Boolean, String)]() + val global = newCompiler("-usejavacp") + import global._ + val r = new Run + r.compileSources(newSourceFile(code) :: Nil) - // Nailing down defacto compiler API from SBT's usage - // https://github.com/sbt/sbt/blob/adb41611cf73260938274915d8462d924df200c8/compile/interface/src/main/scala/xsbt/Analyzer.scala#L29-L41 - def isTopLevelModule(sym: Symbol) = sym.isTopLevel && sym.isModule - for (unit <- currentRun.units if !unit.isJava) { - val sourceFile = unit.source.file.file - for (iclass <- unit.icode) { - val sym = iclass.symbol - def addGenerated(separatorRequired: Boolean) { - results += (separatorRequired -> sym.fullName) - } - if (sym.isModuleClass && !sym.isImplClass) { - if (isTopLevelModule(sym) && sym.companionClass == NoSymbol) - addGenerated(false) - addGenerated(true) - } else - addGenerated(false) + val results = collection.mutable.Buffer[(Boolean, String)]() + + // Nailing down defacto compiler API from SBT's usage + // https://github.com/sbt/sbt/blob/adb41611cf73260938274915d8462d924df200c8/compile/interface/src/main/scala/xsbt/Analyzer.scala#L29-L41 + def isTopLevelModule(sym: Symbol) = sym.isTopLevel && sym.isModule + for (unit <- currentRun.units if !unit.isJava) { + val sourceFile = unit.source.file.file + for (iclass <- unit.icode) { + val sym = iclass.symbol + def addGenerated(separatorRequired: Boolean) { + results += (separatorRequired -> sym.fullName) } + if (sym.isModuleClass && !sym.isImplClass) { + if (isTopLevelModule(sym) && sym.companionClass == NoSymbol) + addGenerated(false) + addGenerated(true) + } else + addGenerated(false) } - val expected = List((false, "C"), (true, "O"), (false, "C$D")) - assert(results.toList == expected, b + ": " + results.toList) } + val expected = List((false, "C"), (true, "O"), (false, "C$D")) + assert(results.toList == expected, s"expected: $expected, actual: ${results.toList}") } } diff --git a/test/files/run/showraw_tree_types_ids.check b/test/files/run/showraw_tree_types_ids.check index 75347463cb..e122148040 100644 --- a/test/files/run/showraw_tree_types_ids.check +++ b/test/files/run/showraw_tree_types_ids.check @@ -4,9 +4,9 @@ Apply[1](Select[2](New[1](TypeTree[1]().setOriginal(AppliedTypeTree(Ident[3](sca [3] TypeRef(ThisType(scala.collection.immutable#<id>), scala.collection.immutable.HashMap#<id>, List()) [4] TypeRef(SingleType(ThisType(scala#<id>), scala.Predef#<id>), TypeName("String")#<id>, List()) [5] SingleType(ThisType(scala#<id>), scala.Predef#<id>) -Apply[6](Select[7](New[6](TypeTree[6]().setOriginal(AppliedTypeTree(Ident[8](scala.collection.mutable.HashMap#<id>), List(TypeTree[4]().setOriginal(Select[4](Ident[5](scala.Predef#<id>), TypeName("String")#<id>)), TypeTree[4]().setOriginal(Select[4](Ident[5](scala.Predef#<id>), TypeName("String")#<id>)))))), termNames.CONSTRUCTOR#<id>), List()) +Apply[1](Select[2](New[1](TypeTree[1]().setOriginal(AppliedTypeTree(Ident[3](scala.collection.mutable.HashMap#<id>), List(TypeTree[4]().setOriginal(Select[4](Ident[5](scala.Predef#<id>), TypeName("String")#<id>)), TypeTree[4]().setOriginal(Select[4](Ident[5](scala.Predef#<id>), TypeName("String")#<id>)))))), termNames.CONSTRUCTOR#<id>), List()) +[1] TypeRef(ThisType(scala.collection.mutable#<id>), scala.collection.mutable.HashMap#<id>, List(TypeRef(SingleType(ThisType(scala#<id>), scala.Predef#<id>), TypeName("String")#<id>, List()), TypeRef(SingleType(ThisType(scala#<id>), scala.Predef#<id>), TypeName("String")#<id>, List()))) +[2] MethodType(List(), TypeRef(ThisType(scala.collection.mutable#<id>), scala.collection.mutable.HashMap#<id>, List(TypeRef(SingleType(ThisType(scala#<id>), scala.Predef#<id>), TypeName("String")#<id>, List()), TypeRef(SingleType(ThisType(scala#<id>), scala.Predef#<id>), TypeName("String")#<id>, List())))) +[3] TypeRef(ThisType(scala.collection.mutable#<id>), scala.collection.mutable.HashMap#<id>, List()) [4] TypeRef(SingleType(ThisType(scala#<id>), scala.Predef#<id>), TypeName("String")#<id>, List()) [5] SingleType(ThisType(scala#<id>), scala.Predef#<id>) -[6] TypeRef(ThisType(scala.collection.mutable#<id>), scala.collection.mutable.HashMap#<id>, List(TypeRef(SingleType(ThisType(scala#<id>), scala.Predef#<id>), TypeName("String")#<id>, List()), TypeRef(SingleType(ThisType(scala#<id>), scala.Predef#<id>), TypeName("String")#<id>, List()))) -[7] MethodType(List(), TypeRef(ThisType(scala.collection.mutable#<id>), scala.collection.mutable.HashMap#<id>, List(TypeRef(SingleType(ThisType(scala#<id>), scala.Predef#<id>), TypeName("String")#<id>, List()), TypeRef(SingleType(ThisType(scala#<id>), scala.Predef#<id>), TypeName("String")#<id>, List())))) -[8] TypeRef(ThisType(scala.collection.mutable#<id>), scala.collection.mutable.HashMap#<id>, List()) diff --git a/test/files/run/showraw_tree_types_typed.check b/test/files/run/showraw_tree_types_typed.check index de691e369e..4934ed41dc 100644 --- a/test/files/run/showraw_tree_types_typed.check +++ b/test/files/run/showraw_tree_types_typed.check @@ -4,9 +4,9 @@ Apply[1](Select[2](New[1](TypeTree[1]().setOriginal(AppliedTypeTree(Ident[3](sca [3] TypeRef(ThisType(scala.collection.immutable), scala.collection.immutable.HashMap, List()) [4] TypeRef(SingleType(ThisType(scala), scala.Predef), TypeName("String"), List()) [5] SingleType(ThisType(scala), scala.Predef) -Apply[6](Select[7](New[6](TypeTree[6]().setOriginal(AppliedTypeTree(Ident[8](scala.collection.mutable.HashMap), List(TypeTree[4]().setOriginal(Select[4](Ident[5](scala.Predef), TypeName("String"))), TypeTree[4]().setOriginal(Select[4](Ident[5](scala.Predef), TypeName("String"))))))), termNames.CONSTRUCTOR), List()) +Apply[1](Select[2](New[1](TypeTree[1]().setOriginal(AppliedTypeTree(Ident[3](scala.collection.mutable.HashMap), List(TypeTree[4]().setOriginal(Select[4](Ident[5](scala.Predef), TypeName("String"))), TypeTree[4]().setOriginal(Select[4](Ident[5](scala.Predef), TypeName("String"))))))), termNames.CONSTRUCTOR), List()) +[1] TypeRef(ThisType(scala.collection.mutable), scala.collection.mutable.HashMap, List(TypeRef(SingleType(ThisType(scala), scala.Predef), TypeName("String"), List()), TypeRef(SingleType(ThisType(scala), scala.Predef), TypeName("String"), List()))) +[2] MethodType(List(), TypeRef(ThisType(scala.collection.mutable), scala.collection.mutable.HashMap, List(TypeRef(SingleType(ThisType(scala), scala.Predef), TypeName("String"), List()), TypeRef(SingleType(ThisType(scala), scala.Predef), TypeName("String"), List())))) +[3] TypeRef(ThisType(scala.collection.mutable), scala.collection.mutable.HashMap, List()) [4] TypeRef(SingleType(ThisType(scala), scala.Predef), TypeName("String"), List()) [5] SingleType(ThisType(scala), scala.Predef) -[6] TypeRef(ThisType(scala.collection.mutable), scala.collection.mutable.HashMap, List(TypeRef(SingleType(ThisType(scala), scala.Predef), TypeName("String"), List()), TypeRef(SingleType(ThisType(scala), scala.Predef), TypeName("String"), List()))) -[7] MethodType(List(), TypeRef(ThisType(scala.collection.mutable), scala.collection.mutable.HashMap, List(TypeRef(SingleType(ThisType(scala), scala.Predef), TypeName("String"), List()), TypeRef(SingleType(ThisType(scala), scala.Predef), TypeName("String"), List())))) -[8] TypeRef(ThisType(scala.collection.mutable), scala.collection.mutable.HashMap, List()) diff --git a/test/files/run/showraw_tree_ultimate.check b/test/files/run/showraw_tree_ultimate.check index 81efcc05ab..b94d568a75 100644 --- a/test/files/run/showraw_tree_ultimate.check +++ b/test/files/run/showraw_tree_ultimate.check @@ -4,9 +4,9 @@ Apply[1](Select[2](New[1](TypeTree[1]().setOriginal(AppliedTypeTree(Ident[3](sca [3] TypeRef(ThisType(scala.collection.immutable#<id>#PKC), scala.collection.immutable.HashMap#<id>#CLS, List()) [4] TypeRef(SingleType(ThisType(scala#<id>#PKC), scala.Predef#<id>#MOD), TypeName("String")#<id>#TPE, List()) [5] SingleType(ThisType(scala#<id>#PKC), scala.Predef#<id>#MOD) -Apply[6](Select[7](New[6](TypeTree[6]().setOriginal(AppliedTypeTree(Ident[8](scala.collection.mutable.HashMap#<id>#CLS), List(TypeTree[4]().setOriginal(Select[4](Ident[5](scala.Predef#<id>#MOD), TypeName("String")#<id>#TPE)), TypeTree[4]().setOriginal(Select[4](Ident[5](scala.Predef#<id>#MOD), TypeName("String")#<id>#TPE)))))), termNames.CONSTRUCTOR#<id>#CTOR), List()) +Apply[1](Select[2](New[1](TypeTree[1]().setOriginal(AppliedTypeTree(Ident[3](scala.collection.mutable.HashMap#<id>#CLS), List(TypeTree[4]().setOriginal(Select[4](Ident[5](scala.Predef#<id>#MOD), TypeName("String")#<id>#TPE)), TypeTree[4]().setOriginal(Select[4](Ident[5](scala.Predef#<id>#MOD), TypeName("String")#<id>#TPE)))))), termNames.CONSTRUCTOR#<id>#CTOR), List()) +[1] TypeRef(ThisType(scala.collection.mutable#<id>#PKC), scala.collection.mutable.HashMap#<id>#CLS, List(TypeRef(SingleType(ThisType(scala#<id>#PKC), scala.Predef#<id>#MOD), TypeName("String")#<id>#TPE, List()), TypeRef(SingleType(ThisType(scala#<id>#PKC), scala.Predef#<id>#MOD), TypeName("String")#<id>#TPE, List()))) +[2] MethodType(List(), TypeRef(ThisType(scala.collection.mutable#<id>#PKC), scala.collection.mutable.HashMap#<id>#CLS, List(TypeRef(SingleType(ThisType(scala#<id>#PKC), scala.Predef#<id>#MOD), TypeName("String")#<id>#TPE, List()), TypeRef(SingleType(ThisType(scala#<id>#PKC), scala.Predef#<id>#MOD), TypeName("String")#<id>#TPE, List())))) +[3] TypeRef(ThisType(scala.collection.mutable#<id>#PKC), scala.collection.mutable.HashMap#<id>#CLS, List()) [4] TypeRef(SingleType(ThisType(scala#<id>#PKC), scala.Predef#<id>#MOD), TypeName("String")#<id>#TPE, List()) [5] SingleType(ThisType(scala#<id>#PKC), scala.Predef#<id>#MOD) -[6] TypeRef(ThisType(scala.collection.mutable#<id>#PKC), scala.collection.mutable.HashMap#<id>#CLS, List(TypeRef(SingleType(ThisType(scala#<id>#PKC), scala.Predef#<id>#MOD), TypeName("String")#<id>#TPE, List()), TypeRef(SingleType(ThisType(scala#<id>#PKC), scala.Predef#<id>#MOD), TypeName("String")#<id>#TPE, List()))) -[7] MethodType(List(), TypeRef(ThisType(scala.collection.mutable#<id>#PKC), scala.collection.mutable.HashMap#<id>#CLS, List(TypeRef(SingleType(ThisType(scala#<id>#PKC), scala.Predef#<id>#MOD), TypeName("String")#<id>#TPE, List()), TypeRef(SingleType(ThisType(scala#<id>#PKC), scala.Predef#<id>#MOD), TypeName("String")#<id>#TPE, List())))) -[8] TypeRef(ThisType(scala.collection.mutable#<id>#PKC), scala.collection.mutable.HashMap#<id>#CLS, List()) diff --git a/test/files/run/synchronized.flags b/test/files/run/synchronized.flags index b9bb09167e..19c578e4ad 100644 --- a/test/files/run/synchronized.flags +++ b/test/files/run/synchronized.flags @@ -1 +1 @@ --optimize -Ybackend:GenASM +-Yopt:l:project diff --git a/test/files/run/t3509.flags b/test/files/run/t3509.flags index 9c59981aa9..422d6be431 100644 --- a/test/files/run/t3509.flags +++ b/test/files/run/t3509.flags @@ -1 +1 @@ --Yinline -Ybackend:GenASM
\ No newline at end of file +-Yopt:l:classpath
\ No newline at end of file diff --git a/test/files/run/t3569.flags b/test/files/run/t3569.flags index 9c59981aa9..422d6be431 100644 --- a/test/files/run/t3569.flags +++ b/test/files/run/t3569.flags @@ -1 +1 @@ --Yinline -Ybackend:GenASM
\ No newline at end of file +-Yopt:l:classpath
\ No newline at end of file diff --git a/test/files/run/t3647.check b/test/files/run/t3647.check new file mode 100644 index 0000000000..e5c1ee1701 --- /dev/null +++ b/test/files/run/t3647.check @@ -0,0 +1 @@ +warning: there were three deprecation warnings; re-run with -deprecation for details diff --git a/test/files/run/t4285.flags b/test/files/run/t4285.flags index 99bd6c895d..422d6be431 100644 --- a/test/files/run/t4285.flags +++ b/test/files/run/t4285.flags @@ -1 +1 @@ --optimise -Ybackend:GenASM
\ No newline at end of file +-Yopt:l:classpath
\ No newline at end of file diff --git a/test/files/run/t4935.flags b/test/files/run/t4935.flags index b9bb09167e..65caa3736e 100644 --- a/test/files/run/t4935.flags +++ b/test/files/run/t4935.flags @@ -1 +1 @@ --optimize -Ybackend:GenASM +-Yopt:l:classpath diff --git a/test/files/run/t4950.check b/test/files/run/t4950.check deleted file mode 100644 index 8994441163..0000000000 --- a/test/files/run/t4950.check +++ /dev/null @@ -1,7 +0,0 @@ - -scala> val 1 = 2 -scala.MatchError: 2 (of class java.lang.Integer) - -scala> val List(1) = List(1) - -scala> :quit diff --git a/test/files/run/t4950.scala b/test/files/run/t4950.scala index cef06027bf..e34b2cf3f2 100644 --- a/test/files/run/t4950.scala +++ b/test/files/run/t4950.scala @@ -1,12 +1,24 @@ -import scala.tools.partest.ReplTest +import scala.tools.partest.SessionTest +import scala.PartialFunction.{ cond => when } + +object Elision { + val elideMsg = """ ... \d+ elided""".r +} + +object Test extends SessionTest { + import Elision._ -object Test extends ReplTest { // Filter out the abbreviated stacktrace "... X elided" // because the number seems to differ between versions/platforms/... - override def show = eval() filterNot (_ contains "elided") foreach println - def code = + def elided(s: String) = when(s) { case elideMsg() => true } + override def eval() = super.eval() filterNot elided + def session = """ -val 1 = 2 -val List(1) = List(1) +scala> val 1 = 2 +scala.MatchError: 2 (of class java.lang.Integer) + +scala> val List(1) = List(1) + +scala> :quit """ } diff --git a/test/files/run/t5789.scala b/test/files/run/t5789.scala index c8d95f2153..677c9ca229 100644 --- a/test/files/run/t5789.scala +++ b/test/files/run/t5789.scala @@ -5,7 +5,7 @@ import scala.tools.partest.ReplTest object Test extends ReplTest { - override def extraSettings = "-Yinline -Ybackend:GenASM" + override def extraSettings = "-Yopt:l:classpath" def code = """ val n = 2 () => n diff --git a/test/files/run/t6028.check b/test/files/run/t6028.check index a768f32976..b3d20a9902 100644 --- a/test/files/run/t6028.check +++ b/test/files/run/t6028.check @@ -50,10 +50,18 @@ package <empty> { <synthetic> <stable> <artifact> def $outer(): T = MethodLocalObject$2.this.$outer; <synthetic> <stable> <artifact> def $outer(): T = MethodLocalObject$2.this.$outer }; - final <stable> private[this] def MethodLocalObject$1(barParam$1: Int, MethodLocalObject$module$1: runtime.VolatileObjectRef): T#MethodLocalObject$2.type = { - MethodLocalObject$module$1.elem = new T#MethodLocalObject$2.type(T.this, barParam$1); + final <stable> private[this] def MethodLocalObject$lzycompute$1(barParam$1: Int, MethodLocalObject$module$1: runtime.VolatileObjectRef): T#MethodLocalObject$2.type = { + T.this.synchronized({ + if (MethodLocalObject$module$1.elem.$asInstanceOf[T#MethodLocalObject$2.type]().eq(null)) + MethodLocalObject$module$1.elem = new T#MethodLocalObject$2.type(T.this, barParam$1); + scala.runtime.BoxedUnit.UNIT + }); MethodLocalObject$module$1.elem.$asInstanceOf[T#MethodLocalObject$2.type]() }; + final <stable> private[this] def MethodLocalObject$1(barParam$1: Int, MethodLocalObject$module$1: runtime.VolatileObjectRef): T#MethodLocalObject$2.type = if (MethodLocalObject$module$1.elem.$asInstanceOf[T#MethodLocalObject$2.type]().eq(null)) + T.this.MethodLocalObject$lzycompute$1(barParam$1, MethodLocalObject$module$1) + else + MethodLocalObject$module$1.elem.$asInstanceOf[T#MethodLocalObject$2.type](); abstract trait MethodLocalTrait$1$class extends Object with T#MethodLocalTrait$1 { def /*MethodLocalTrait$1$class*/$init$(barParam$1: Int): Unit = { () diff --git a/test/files/run/t6188.flags b/test/files/run/t6188.flags index b9bb09167e..422d6be431 100644 --- a/test/files/run/t6188.flags +++ b/test/files/run/t6188.flags @@ -1 +1 @@ --optimize -Ybackend:GenASM +-Yopt:l:classpath
\ No newline at end of file diff --git a/test/files/run/t6288.check b/test/files/run/t6288.check index a032a10de6..67877fd56d 100644 --- a/test/files/run/t6288.check +++ b/test/files/run/t6288.check @@ -33,11 +33,8 @@ [175]case <synthetic> val x1: [175]Any = [175]""; [175]case5()[195]{ [195]<synthetic> val o7: [195]Option[List[Int]] = [195][195]Case4.unapplySeq([195]x1); - [195]if ([195]o7.isEmpty.unary_!) - [195]if ([195][195][195][195]o7.get.!=([195]null).&&([195][195][195][195]o7.get.lengthCompare([195]1).==([195]0))) - [208][208]matchEnd4([208]()) - else - [195][195]case6() + [195]if ([195][195]o7.isEmpty.unary_!.&&([195][195][195][195]o7.get.!=([195]null).&&([195][195][195][195]o7.get.lengthCompare([195]1).==([195]0)))) + [208][208]matchEnd4([208]()) else [195][195]case6() }; @@ -59,11 +56,8 @@ [273]case <synthetic> val x1: [273]Any = [273]""; [273]case5()[293]{ [293]<synthetic> val o7: [293]Option[List[Int]] = [293][293]Case4.unapplySeq([293]x1); - [293]if ([293]o7.isEmpty.unary_!) - [293]if ([293][293][293][293]o7.get.!=([293]null).&&([293][293][293][293]o7.get.lengthCompare([293]0).==([293]0))) - [304][304]matchEnd4([304]()) - else - [293][293]case6() + [293]if ([293][293]o7.isEmpty.unary_!.&&([293][293][293][293]o7.get.!=([293]null).&&([293][293][293][293]o7.get.lengthCompare([293]0).==([293]0)))) + [304][304]matchEnd4([304]()) else [293][293]case6() }; diff --git a/test/files/run/t6546.flags b/test/files/run/t6546.flags deleted file mode 100644 index 6015e7c61f..0000000000 --- a/test/files/run/t6546.flags +++ /dev/null @@ -1 +0,0 @@ --Ybackend:GenASM -optimise
\ No newline at end of file diff --git a/test/files/run/t6546/A_1.scala b/test/files/run/t6546/A_1.scala deleted file mode 100644 index bd086c08f8..0000000000 --- a/test/files/run/t6546/A_1.scala +++ /dev/null @@ -1,6 +0,0 @@ -final class Opt { - @inline def getOrElse(x: => String): String = "" -} -class A_1 { - def f(x: Opt): String = x getOrElse null -} diff --git a/test/files/run/t6546/B_2.scala b/test/files/run/t6546/B_2.scala deleted file mode 100644 index 64ec966f75..0000000000 --- a/test/files/run/t6546/B_2.scala +++ /dev/null @@ -1,8 +0,0 @@ -import scala.tools.partest.BytecodeTest - -object Test extends BytecodeTest { - def show: Unit = { - val node = loadClassNode("A_1") - assert(node.innerClasses.isEmpty, node.innerClasses) - } -} diff --git a/test/files/run/t7008-scala-defined.flags b/test/files/run/t7008-scala-defined.flags index 49f2d2c4c8..e69de29bb2 100644 --- a/test/files/run/t7008-scala-defined.flags +++ b/test/files/run/t7008-scala-defined.flags @@ -1 +0,0 @@ --Ybackend:GenASM diff --git a/test/files/run/t7459b-optimize.flags b/test/files/run/t7459b-optimize.flags index b9bb09167e..65caa3736e 100644 --- a/test/files/run/t7459b-optimize.flags +++ b/test/files/run/t7459b-optimize.flags @@ -1 +1 @@ --optimize -Ybackend:GenASM +-Yopt:l:classpath diff --git a/test/files/run/t7582.flags b/test/files/run/t7582.flags index 2cd4b38726..422d6be431 100644 --- a/test/files/run/t7582.flags +++ b/test/files/run/t7582.flags @@ -1 +1 @@ --optimize -Ybackend:GenASM
\ No newline at end of file +-Yopt:l:classpath
\ No newline at end of file diff --git a/test/files/run/t7582b.flags b/test/files/run/t7582b.flags index 2cd4b38726..422d6be431 100644 --- a/test/files/run/t7582b.flags +++ b/test/files/run/t7582b.flags @@ -1 +1 @@ --optimize -Ybackend:GenASM
\ No newline at end of file +-Yopt:l:classpath
\ No newline at end of file diff --git a/test/files/run/t7634.check b/test/files/run/t7634.check index 879aea67a2..43128cad95 100644 --- a/test/files/run/t7634.check +++ b/test/files/run/t7634.check @@ -1,6 +1,6 @@ -scala> .lines -res1: List[String] = List(shello, world.) +scala> .lines.foreach(println) +shello, world. scala> :quit diff --git a/test/files/run/t7634.scala b/test/files/run/t7634.scala index aeb6a5e671..9520931941 100644 --- a/test/files/run/t7634.scala +++ b/test/files/run/t7634.scala @@ -9,7 +9,7 @@ import scala.util.Properties.propOrElse object Test extends ReplTest { def java = propOrElse("javacmd", "java") def code = s""":sh $java -classpath $testOutput hello.Hello - |.lines""".stripMargin + |.lines.foreach(println)""".stripMargin } package hello { diff --git a/test/files/run/t8601-closure-elim.flags b/test/files/run/t8601-closure-elim.flags index 9158076b71..642187ff4c 100644 --- a/test/files/run/t8601-closure-elim.flags +++ b/test/files/run/t8601-closure-elim.flags @@ -1 +1 @@ --optimize -Ydelambdafy:inline -Ybackend:GenASM +-Ydelambdafy:method -Yopt:l:classpath diff --git a/test/files/run/t8601-closure-elim.scala b/test/files/run/t8601-closure-elim.scala index ebeb16e0c7..40fbf1fe0e 100644 --- a/test/files/run/t8601-closure-elim.scala +++ b/test/files/run/t8601-closure-elim.scala @@ -1,4 +1,5 @@ import scala.tools.partest.BytecodeTest +import scala.tools.partest.ASMConverters.instructionsFromMethod import scala.tools.asm import scala.tools.asm.util._ import scala.collection.JavaConverters._ @@ -10,8 +11,9 @@ object Test extends BytecodeTest { def test(methodName: String) { val classNode = loadClassNode("Foo") val methodNode = getMethod(classNode, "b") + val instrs = instructionsFromMethod(methodNode) val ops = methodNode.instructions.iterator.asScala.map(_.getOpcode).toList - assert(!ops.contains(asm.Opcodes.NEW), ops)// should be allocation free if the closure is eliminated + assert(!ops.contains(asm.Opcodes.NEW), instrs)// should be allocation free if the closure is eliminated } test("b") } diff --git a/test/files/run/t8601.flags b/test/files/run/t8601.flags index 2cd4b38726..65caa3736e 100644 --- a/test/files/run/t8601.flags +++ b/test/files/run/t8601.flags @@ -1 +1 @@ --optimize -Ybackend:GenASM
\ No newline at end of file +-Yopt:l:classpath diff --git a/test/files/run/t8601b.flags b/test/files/run/t8601b.flags index 2cd4b38726..65caa3736e 100644 --- a/test/files/run/t8601b.flags +++ b/test/files/run/t8601b.flags @@ -1 +1 @@ --optimize -Ybackend:GenASM
\ No newline at end of file +-Yopt:l:classpath diff --git a/test/files/run/t8601c.flags b/test/files/run/t8601c.flags index 2cd4b38726..65caa3736e 100644 --- a/test/files/run/t8601c.flags +++ b/test/files/run/t8601c.flags @@ -1 +1 @@ --optimize -Ybackend:GenASM
\ No newline at end of file +-Yopt:l:classpath diff --git a/test/files/run/t8601d.flags b/test/files/run/t8601d.flags index 2cd4b38726..65caa3736e 100644 --- a/test/files/run/t8601d.flags +++ b/test/files/run/t8601d.flags @@ -1 +1 @@ --optimize -Ybackend:GenASM
\ No newline at end of file +-Yopt:l:classpath diff --git a/test/files/run/t8601e.flags b/test/files/run/t8601e.flags index b9bb09167e..65caa3736e 100644 --- a/test/files/run/t8601e.flags +++ b/test/files/run/t8601e.flags @@ -1 +1 @@ --optimize -Ybackend:GenASM +-Yopt:l:classpath diff --git a/test/files/run/t9003.flags b/test/files/run/t9003.flags index b9bb09167e..65caa3736e 100644 --- a/test/files/run/t9003.flags +++ b/test/files/run/t9003.flags @@ -1 +1 @@ --optimize -Ybackend:GenASM +-Yopt:l:classpath diff --git a/test/files/run/t9110.scala b/test/files/run/t9110.scala new file mode 100644 index 0000000000..660291a4d1 --- /dev/null +++ b/test/files/run/t9110.scala @@ -0,0 +1,27 @@ +trait Event + +trait Domain { + case class Created(name: String) extends Event +} + +// declare three instances of Domain trait, one here and two +// in an inner scope + +object DomainC extends Domain + +object Test { + def main(args: Array[String]) { + object DomainA extends Domain + object DomainB extends Domain + + def lookingForAs(event: Event): Unit = { + event match { + case DomainB.Created(_) => throw null + case DomainC.Created(_) => throw null + case DomainA.Created(_) => // okay + } + } + + lookingForAs(DomainA.Created("I am an A")) + } +} diff --git a/test/files/run/t9178a.flags b/test/files/run/t9178a.flags new file mode 100644 index 0000000000..48fd867160 --- /dev/null +++ b/test/files/run/t9178a.flags @@ -0,0 +1 @@ +-Xexperimental diff --git a/test/files/run/t9178a.scala b/test/files/run/t9178a.scala new file mode 100644 index 0000000000..4788841f8d --- /dev/null +++ b/test/files/run/t9178a.scala @@ -0,0 +1,15 @@ +trait Sam { def apply(): Unit } +abstract class Test { + def foo(): Sam + // no parens, instantiateToMethodType would wrap in a `new Sam { def apply = foo }` + // rather than applying to an empty param list() */ + val f: Sam = foo +} + +object Test extends Test { + lazy val samIAm = new Sam { def apply() {} } + def foo() = samIAm + def main(args: Array[String]): Unit = { + assert(f eq samIAm, f) + } +} diff --git a/test/files/run/t9403.flags b/test/files/run/t9403.flags index 307668060c..65caa3736e 100644 --- a/test/files/run/t9403.flags +++ b/test/files/run/t9403.flags @@ -1 +1 @@ --Ybackend:GenASM -optimize +-Yopt:l:classpath diff --git a/test/files/run/t9489.flags b/test/files/run/t9489.flags new file mode 100644 index 0000000000..48fd867160 --- /dev/null +++ b/test/files/run/t9489.flags @@ -0,0 +1 @@ +-Xexperimental diff --git a/test/files/run/t9489/A.java b/test/files/run/t9489/A.java new file mode 100644 index 0000000000..c3536faa14 --- /dev/null +++ b/test/files/run/t9489/A.java @@ -0,0 +1,3 @@ +public class A { + public B b() { return null; } +} diff --git a/test/files/run/t9489/B.java b/test/files/run/t9489/B.java new file mode 100644 index 0000000000..e5d1278cd7 --- /dev/null +++ b/test/files/run/t9489/B.java @@ -0,0 +1,3 @@ +public abstract class B { + public abstract int m(); +} diff --git a/test/files/run/t9489/test.scala b/test/files/run/t9489/test.scala new file mode 100644 index 0000000000..1b745af865 --- /dev/null +++ b/test/files/run/t9489/test.scala @@ -0,0 +1,10 @@ +class T { + def f(a: A) = g(a.b) // was: "found Int, required B" + def g(b: => B) = null +} + +object Test extends T { + def main(args: Array[String]): Unit = { + f(new A) + } +} diff --git a/test/files/run/trait-defaults-modules.scala b/test/files/run/trait-defaults-modules.scala new file mode 100644 index 0000000000..93fc74baff --- /dev/null +++ b/test/files/run/trait-defaults-modules.scala @@ -0,0 +1,20 @@ +trait T1 { def a: Any } + +trait T2 extends T1 { object a; object b; private object c; def usec: Any = c} +trait T3 extends T2 + +class C1 extends T1 { object a; object b } +class C2 extends C1 +class C3 extends T2 +class C4 extends T3 + +object Test { + def main(args: Array[String]): Unit = { + val (c1, c2, c3, c4) = (new C1, new C2, new C3, new C4) + c1.a; c1.b; (c1: T1).a + c2.a; c2.b; (c2: T1).a + c3.a; c3.b; (c3: T1).a; c3.usec + c4.a; c4.b; (c4: T1).a; c4.usec + } + +} diff --git a/test/files/run/trait-defaults-modules2/T_1.scala b/test/files/run/trait-defaults-modules2/T_1.scala new file mode 100644 index 0000000000..962acdade1 --- /dev/null +++ b/test/files/run/trait-defaults-modules2/T_1.scala @@ -0,0 +1,4 @@ +trait T { + private object O + def useO: Any = O +} diff --git a/test/files/run/trait-defaults-modules2/Test_2.scala b/test/files/run/trait-defaults-modules2/Test_2.scala new file mode 100644 index 0000000000..a1c49f5ddd --- /dev/null +++ b/test/files/run/trait-defaults-modules2/Test_2.scala @@ -0,0 +1,5 @@ +object Test extends T { + def main(args: Array[String]): Unit = { + useO + } +} diff --git a/test/files/run/trait-defaults-modules3.scala b/test/files/run/trait-defaults-modules3.scala new file mode 100644 index 0000000000..8790a95f4c --- /dev/null +++ b/test/files/run/trait-defaults-modules3.scala @@ -0,0 +1,8 @@ +object Test { + def main(args: Array[String]): Unit = { + object O + val x = O + val y = O + assert(x eq y) + } +} diff --git a/test/files/scalacheck/parallel-collections/ParallelRangeCheck.scala b/test/files/scalacheck/parallel-collections/ParallelRangeCheck.scala index f490d9490a..a80d1a27a1 100644 --- a/test/files/scalacheck/parallel-collections/ParallelRangeCheck.scala +++ b/test/files/scalacheck/parallel-collections/ParallelRangeCheck.scala @@ -27,7 +27,7 @@ class ParallelRangeCheck(val tasksupport: TaskSupport) extends ParallelSeqCheck[ def isCheckingViews = false - def ofSize(vals: Seq[Gen[Int]], sz: Int) = unsupported + def ofSize(vals: Seq[Gen[Int]], sz: Int) = throw new UnsupportedOperationException override def instances(vals: Seq[Gen[Int]]): Gen[Seq[Int]] = sized { start => sized { end => diff --git a/test/junit/scala/PartialFunctionSerializationTest.scala b/test/junit/scala/PartialFunctionSerializationTest.scala new file mode 100644 index 0000000000..d525b045cd --- /dev/null +++ b/test/junit/scala/PartialFunctionSerializationTest.scala @@ -0,0 +1,36 @@ +package scala + +import org.junit.Test +import org.junit.Assert._ +import org.junit.runner.RunWith +import org.junit.runners.JUnit4 + +@RunWith(classOf[JUnit4]) +class PartialFunctionSerializationTest { + val pf1: PartialFunction[Int, Int] = { + case n if n > 0 => 1 + } + + val pf2: PartialFunction[Int, Int] = { + case n if n <= 0 => 2 + } + + + private def assertSerializable[A,B](fn: A => B) = { + import java.io._ + + new ObjectOutputStream(new ByteArrayOutputStream()).writeObject(fn) + } + + @Test def canSerializeLiteral= assertSerializable(pf1) + + @Test def canSerializeLifted= assertSerializable(pf1.lift) + + @Test def canSerializeOrElse = assertSerializable(pf1 orElse pf2) + + @Test def canSerializeUnlifted = assertSerializable(Function.unlift((x: Int) => Some(x))) + + @Test def canSerializeAndThen = assertSerializable(pf1.andThen((x: Int) => x)) + + @Test def canSerializeEmpty = assertSerializable(PartialFunction.empty) +} diff --git a/test/junit/scala/StringContextTest.scala b/test/junit/scala/StringContextTest.scala index 900852fcc6..b5af6de7eb 100644 --- a/test/junit/scala/StringContextTest.scala +++ b/test/junit/scala/StringContextTest.scala @@ -1,6 +1,8 @@ package scala +import java.text.DecimalFormat + import language.implicitConversions import org.junit.Test @@ -10,10 +12,32 @@ import org.junit.runners.JUnit4 import scala.tools.testing.AssertUtil._ +object StringContextTestUtils { + private val decimalSeparator: Char = new DecimalFormat().getDecimalFormatSymbols().getDecimalSeparator() + private val numberPattern = """(\d+)\.(\d+.*)""".r + + implicit class StringContextOps(val sc: StringContext) extends AnyVal { + // Use this String interpolator to avoid problems with a locale-dependent decimal mark. + def locally(numbers: String*): String = { + val numbersWithCorrectLocale = numbers.map(applyProperLocale) + sc.s(numbersWithCorrectLocale: _*) + } + + // Handles cases like locally"3.14" - it's prettier than locally"${"3.14"}". + def locally(): String = sc.parts.map(applyProperLocale).mkString + + private def applyProperLocale(number: String): String = { + val numberPattern(intPart, fractionalPartAndSuffix) = number + s"$intPart$decimalSeparator$fractionalPartAndSuffix" + } + } +} + @RunWith(classOf[JUnit4]) class StringContextTest { import StringContext._ + import StringContextTestUtils.StringContextOps @Test def noEscape() = { val s = "string" @@ -67,26 +91,22 @@ class StringContextTest { @Test def fIf() = { val res = f"${if (true) 2.5 else 2.5}%.2f" - val expected = formatUsingCurrentLocale(2.50) + val expected = locally"2.50" assertEquals(expected, res) } @Test def fIfNot() = { val res = f"${if (false) 2.5 else 3.5}%.2f" - val expected = formatUsingCurrentLocale(3.50) + val expected = locally"3.50" assertEquals(expected, res) } @Test def fHeteroArgs() = { val res = f"${3.14}%.2f rounds to ${3}%d" - val expected = formatUsingCurrentLocale(3.14) + " rounds to 3" + val expected = locally"${"3.14"} rounds to 3" assertEquals(expected, res) } - // Use this method to avoid problems with a locale-dependent decimal mark. - // The string interpolation is not used here intentionally as this method is used to test string interpolation. - private def formatUsingCurrentLocale(number: Double, decimalPlaces: Int = 2) = ("%." + decimalPlaces + "f").format(number) - @Test def `f interpolator baseline`(): Unit = { implicit def stringToBoolean(s: String): Boolean = java.lang.Boolean.parseBoolean(s) @@ -203,17 +223,17 @@ class StringContextTest { // 'e' | 'E' | 'g' | 'G' | 'f' | 'a' | 'A' (category: floating point) // ------------------------------------------------------------------ - f"${3.4f}%e" -> "3.400000e+00", - f"${3.4}%e" -> "3.400000e+00", - f"${3.4f : java.lang.Float}%e" -> "3.400000e+00", - f"${3.4 : java.lang.Double}%e" -> "3.400000e+00", + f"${3.4f}%e" -> locally"3.400000e+00", + f"${3.4}%e" -> locally"3.400000e+00", + f"${3.4f : java.lang.Float}%e" -> locally"3.400000e+00", + f"${3.4 : java.lang.Double}%e" -> locally"3.400000e+00", - f"${BigDecimal(3.4)}%e" -> "3.400000e+00", + f"${BigDecimal(3.4)}%e" -> locally"3.400000e+00", - f"${new java.math.BigDecimal(3.4)}%e" -> "3.400000e+00", + f"${new java.math.BigDecimal(3.4)}%e" -> locally"3.400000e+00", - f"${3}%e" -> "3.000000e+00", - f"${3L}%e" -> "3.000000e+00", + f"${3}%e" -> locally"3.000000e+00", + f"${3L}%e" -> locally"3.000000e+00", // 't' | 'T' (category: date/time) // ------------------------------- @@ -224,11 +244,10 @@ class StringContextTest { // literals and arg indexes f"%%" -> "%", - f" mind%n------%nmatter%n" -> + f" mind%n------%nmatter" -> """| mind |------ - |matter - |""".stripMargin, + |matter""".stripMargin.lines.mkString(compat.Platform.EOL), f"${i}%d %<d ${9}%d" -> "42 42 9", f"${7}%d %<d ${9}%d" -> "7 7 9", f"${7}%d %2$$d ${9}%d" -> "7 9 9", @@ -237,7 +256,7 @@ class StringContextTest { f"${5: Any}" -> "5", f"${5}%s%<d" -> "55", - f"${3.14}%s,%<f" -> "3.14,3.140000", + f"${3.14}%s,%<f" -> locally"3.14,${"3.140000"}", f"z" -> "z" ) diff --git a/test/junit/scala/collection/mutable/SetLikeTest.scala b/test/junit/scala/collection/mutable/SetLikeTest.scala new file mode 100644 index 0000000000..c819024558 --- /dev/null +++ b/test/junit/scala/collection/mutable/SetLikeTest.scala @@ -0,0 +1,26 @@ +package scala.collection.mutable + +import org.junit.Assert._ +import org.junit.Test +import org.junit.runner.RunWith +import org.junit.runners.JUnit4 + +@RunWith(classOf[JUnit4]) +class SetLikeTest { + + class MySet(self: Set[String]) extends Set[String] with SetLike[String, MySet] { + override def -=(elem: String) = { self -= elem; this } + override def +=(elem: String) = { self += elem; this } + + override def empty = new MySet(self.empty) + override def iterator = self.iterator + override def contains(elem: String) = self.contains(elem) + } + + @Test + def hasCorrectClear() { + val s = new MySet(Set("EXPOSEDNODE", "CONNECTABLE")) + s.clear() + assertEquals(new MySet(Set()), s) + } +} diff --git a/test/junit/scala/sys/process/t7350.scala b/test/junit/scala/sys/process/t7350.scala index 7f3e8897f2..3c0e5145e6 100644 --- a/test/junit/scala/sys/process/t7350.scala +++ b/test/junit/scala/sys/process/t7350.scala @@ -18,6 +18,7 @@ import scala.util.control.Exception.ignoring class PipedProcessTest { class ProcessMock(error: Boolean) extends Process { var destroyCount = 0 + def isAlive() = false def exitValue(): Int = { if (error) { throw new InterruptedException() diff --git a/test/junit/scala/tools/nsc/transform/delambdafy/DelambdafyTest.scala b/test/junit/scala/tools/nsc/transform/delambdafy/DelambdafyTest.scala new file mode 100644 index 0000000000..010078e28a --- /dev/null +++ b/test/junit/scala/tools/nsc/transform/delambdafy/DelambdafyTest.scala @@ -0,0 +1,73 @@ +package scala.tools.nsc.transform.delambdafy + +import scala.reflect.io.Path.jfile2path +import scala.tools.nsc.backend.jvm.CodeGenTools.getGeneratedClassfiles +import scala.tools.nsc.backend.jvm.CodeGenTools.makeSourceFile +import scala.tools.nsc.backend.jvm.CodeGenTools.newCompilerWithoutVirtualOutdir +import scala.tools.nsc.io.AbstractFile +import scala.tools.testing.TempDir + +import org.junit.Assert.assertTrue +import org.junit.Test +import org.junit.runner.RunWith +import org.junit.runners.JUnit4 + +@RunWith(classOf[JUnit4]) +class DelambdafyTest { + def compileToMultipleOutputWithDelamdbafyMethod(): List[(String, Array[Byte])] = { + val codeForMultiOutput = """ +object Delambdafy { + type -->[D, I] = PartialFunction[D, I] + + def main(args: Array[String]): Unit = { + val result = List(1, 2, 4).map { a => + val list = List("1", "2", "3").map { _ + "test" } + list.find { _ == a.toString + "test" } + } + println(result) + lazy val _foo = foo(result) { + case x :: xs if x isDefined => x.get.length + case _ => 0 + } + println(_foo) + lazy val bar: Int => Int = { + case 2 => 23 + case _ => + val v = List(1).map { _ + 42 }.head + v + 31 + } + bar(3) + lazy val _baz = baz { + case 1 => + val local = List(1).map(_ + 1) + local.head + } + } + + def baz[T](f: Any --> Any): Any => Any = f + + def foo(b: List[Option[String]])(a: List[Option[String]] => Int): Int = a(b) +} +""" + val srcFile = makeSourceFile(codeForMultiOutput, "delambdafyTest.scala") + val outDir = AbstractFile.getDirectory(TempDir.createTempDir()) + val outDirPath = outDir.canonicalPath + val extraArgs = "-Ybackend:GenBCode -Ydelambdafy:method" + val argsWithOutDir = extraArgs + s" -d $outDirPath -cp $outDirPath" + val compiler = newCompilerWithoutVirtualOutdir(extraArgs = argsWithOutDir) + compiler.settings.outputDirs.add(srcFile.file, outDir) + + new compiler.Run().compileSources(List(srcFile)) + + val classfiles = getGeneratedClassfiles(outDir) + outDir.delete() + classfiles + } + + @Test + def shouldFindOutputFoldersForAllPromotedLambdasAsMethod(): Unit = { + val actual = compileToMultipleOutputWithDelamdbafyMethod() + + assertTrue(actual.length > 0) + } +} diff --git a/test/junit/scala/util/SystemPropertiesTest.scala b/test/junit/scala/util/SystemPropertiesTest.scala new file mode 100644 index 0000000000..38e830eb88 --- /dev/null +++ b/test/junit/scala/util/SystemPropertiesTest.scala @@ -0,0 +1,27 @@ +package scala.util + +import org.junit.runner.RunWith +import org.junit.runners.JUnit4 +import org.junit.Test +import org.junit.Assert._ + +@RunWith(classOf[JUnit4]) +class SystemPropertiesTest { + @Test + def filterAll(): Unit = { + val isEmpty = sys.props.filter(_ => false).size == 0 + assertTrue("A filter matching nothing should produce an empty result", isEmpty) + } + + @Test + def filterNone(): Unit = { + val isUnchanged = sys.props.filter(_ => true) == sys.props + assertTrue("A filter matching everything should not change the result", isUnchanged) + } + + @Test + def empty(): Unit = { + val hasSize0 = sys.props.empty.size == 0 + assertTrue("SystemProperties.empty should have size of 0", hasSize0) + } +} diff --git a/test/partest b/test/partest index 6f14dfe1bc..07a5de12af 100755 --- a/test/partest +++ b/test/partest @@ -22,6 +22,14 @@ findScalaHome () { } # Use tput to detect color-capable terminal. +# (note: I have found that on Cygwin, the script sometimes dies here. +# it doesn't happen from the Cygwin prompt when ssh'ing in to +# jenkins-worker-windows-publish, only when I make a Jenkins job +# that runs this script. I don't know why. it may have to do with +# which bash flags are set (-e? -x?) and with bash flags propagating +# from one script to another? not sure. anyway, normally in a CI +# context we run partest through ant, not through this script, so I'm +# not investigating further for now.) term_colors=$(tput colors 2>/dev/null) if [[ $? == 0 ]] && [[ $term_colors -gt 2 ]]; then git_diff_options="--color=always --word-diff" diff --git a/test/pending/jvm/constant-optimization/Foo_1.flags b/test/pending/jvm/constant-optimization/Foo_1.flags new file mode 100644 index 0000000000..9691c0985d --- /dev/null +++ b/test/pending/jvm/constant-optimization/Foo_1.flags @@ -0,0 +1 @@ +// constant otimization not there yet, -Yopt:nullness-tracking not enough. diff --git a/test/files/jvm/constant-optimization/Foo_1.scala b/test/pending/jvm/constant-optimization/Foo_1.scala index cb67ad4e90..6f408044d7 100644 --- a/test/files/jvm/constant-optimization/Foo_1.scala +++ b/test/pending/jvm/constant-optimization/Foo_1.scala @@ -1,6 +1,6 @@ class Foo_1 { def foo() { - // constant optimization should eliminate all branches + // constant optimization should eliminate all branches val i = 1 val x = if (i != 1) null else "good" val y = if (x == null) "good" else x + "" diff --git a/test/files/jvm/constant-optimization/Test.scala b/test/pending/jvm/constant-optimization/Test.scala index dc0f8f6103..dc0f8f6103 100644 --- a/test/files/jvm/constant-optimization/Test.scala +++ b/test/pending/jvm/constant-optimization/Test.scala diff --git a/test/files/jvm/patmat_opt_ignore_underscore.check b/test/pending/jvm/patmat_opt_ignore_underscore.check index 43f53aba12..43f53aba12 100644 --- a/test/files/jvm/patmat_opt_ignore_underscore.check +++ b/test/pending/jvm/patmat_opt_ignore_underscore.check diff --git a/test/pending/jvm/patmat_opt_ignore_underscore.flags b/test/pending/jvm/patmat_opt_ignore_underscore.flags new file mode 100644 index 0000000000..453b6b7895 --- /dev/null +++ b/test/pending/jvm/patmat_opt_ignore_underscore.flags @@ -0,0 +1 @@ +-Yopt:l:project
\ No newline at end of file diff --git a/test/files/jvm/patmat_opt_ignore_underscore/Analyzed_1.scala b/test/pending/jvm/patmat_opt_ignore_underscore/Analyzed_1.scala index b0506018f6..b0506018f6 100644 --- a/test/files/jvm/patmat_opt_ignore_underscore/Analyzed_1.scala +++ b/test/pending/jvm/patmat_opt_ignore_underscore/Analyzed_1.scala diff --git a/test/files/jvm/patmat_opt_ignore_underscore/test.scala b/test/pending/jvm/patmat_opt_ignore_underscore/test.scala index d6630e80a0..d6630e80a0 100644 --- a/test/files/jvm/patmat_opt_ignore_underscore/test.scala +++ b/test/pending/jvm/patmat_opt_ignore_underscore/test.scala diff --git a/test/files/jvm/patmat_opt_no_nullcheck.check b/test/pending/jvm/patmat_opt_no_nullcheck.check index 43f53aba12..43f53aba12 100644 --- a/test/files/jvm/patmat_opt_no_nullcheck.check +++ b/test/pending/jvm/patmat_opt_no_nullcheck.check diff --git a/test/pending/jvm/patmat_opt_no_nullcheck.flags b/test/pending/jvm/patmat_opt_no_nullcheck.flags new file mode 100644 index 0000000000..453b6b7895 --- /dev/null +++ b/test/pending/jvm/patmat_opt_no_nullcheck.flags @@ -0,0 +1 @@ +-Yopt:l:project
\ No newline at end of file diff --git a/test/files/jvm/patmat_opt_no_nullcheck/Analyzed_1.scala b/test/pending/jvm/patmat_opt_no_nullcheck/Analyzed_1.scala index 1e4d564cdf..1e4d564cdf 100644 --- a/test/files/jvm/patmat_opt_no_nullcheck/Analyzed_1.scala +++ b/test/pending/jvm/patmat_opt_no_nullcheck/Analyzed_1.scala diff --git a/test/pending/jvm/patmat_opt_no_nullcheck/test.scala b/test/pending/jvm/patmat_opt_no_nullcheck/test.scala new file mode 100644 index 0000000000..5a4a398b67 --- /dev/null +++ b/test/pending/jvm/patmat_opt_no_nullcheck/test.scala @@ -0,0 +1,14 @@ +/* + * filter: inliner warning; re-run with + */ +import scala.tools.partest.{ BytecodeTest, ASMConverters } + +object Test extends BytecodeTest { + def show: Unit = { + val classNode = loadClassNode("SameBytecode") + // ASM and GenBCode assign variable slots slightly differently + val instrsA = ASMConverters.instructionsFromMethod(getMethod(classNode, "a")) + val instrsB = ASMConverters.instructionsFromMethod(getMethod(classNode, "b")) + assert(ASMConverters.equivalentBytecode(instrsA, instrsB), diffInstructions(instrsA, instrsB)) // doesn't work + } +} diff --git a/test/files/jvm/patmat_opt_primitive_typetest.check b/test/pending/jvm/patmat_opt_primitive_typetest.check index 43f53aba12..43f53aba12 100644 --- a/test/files/jvm/patmat_opt_primitive_typetest.check +++ b/test/pending/jvm/patmat_opt_primitive_typetest.check diff --git a/test/pending/jvm/patmat_opt_primitive_typetest.flags b/test/pending/jvm/patmat_opt_primitive_typetest.flags new file mode 100644 index 0000000000..19c578e4ad --- /dev/null +++ b/test/pending/jvm/patmat_opt_primitive_typetest.flags @@ -0,0 +1 @@ +-Yopt:l:project diff --git a/test/files/jvm/patmat_opt_primitive_typetest/Analyzed_1.scala b/test/pending/jvm/patmat_opt_primitive_typetest/Analyzed_1.scala index c961082fa7..c961082fa7 100644 --- a/test/files/jvm/patmat_opt_primitive_typetest/Analyzed_1.scala +++ b/test/pending/jvm/patmat_opt_primitive_typetest/Analyzed_1.scala diff --git a/test/files/jvm/patmat_opt_primitive_typetest/test.scala b/test/pending/jvm/patmat_opt_primitive_typetest/test.scala index 2927e763d5..2927e763d5 100644 --- a/test/files/jvm/patmat_opt_primitive_typetest/test.scala +++ b/test/pending/jvm/patmat_opt_primitive_typetest/test.scala diff --git a/test/files/jvm/t7006.check b/test/pending/jvm/t7006.check index 6294b14d62..6294b14d62 100644 --- a/test/files/jvm/t7006.check +++ b/test/pending/jvm/t7006.check diff --git a/test/pending/jvm/t7006/Foo_1.flags b/test/pending/jvm/t7006/Foo_1.flags new file mode 100644 index 0000000000..5d1b6b2644 --- /dev/null +++ b/test/pending/jvm/t7006/Foo_1.flags @@ -0,0 +1 @@ +-Yopt:l:project -Ydebug -Xfatal-warnings diff --git a/test/files/jvm/t7006/Foo_1.scala b/test/pending/jvm/t7006/Foo_1.scala index 3985557d9f..3985557d9f 100644 --- a/test/files/jvm/t7006/Foo_1.scala +++ b/test/pending/jvm/t7006/Foo_1.scala diff --git a/test/files/jvm/t7006/Test.scala b/test/pending/jvm/t7006/Test.scala index 065a23510e..7b4a8c45fb 100644 --- a/test/files/jvm/t7006/Test.scala +++ b/test/pending/jvm/t7006/Test.scala @@ -7,8 +7,10 @@ object Test extends BytecodeTest { def show: Unit = { val classNode = loadClassNode("Foo_1") val methodNode = getMethod(classNode, "foo") - assert(count(methodNode.instructions, asm.Opcodes.NOP) == 0) - assert(count(methodNode.instructions, asm.Opcodes.GOTO) == 1) + val nopCount = count(methodNode.instructions, asm.Opcodes.NOP) + val gotoCount = count(methodNode.instructions, asm.Opcodes.GOTO) + assert(nopCount == 0, s"NOPs expected: 0, actual: $nopCount") + assert(gotoCount == 1, s"GOTOs expected: 1, actual: $gotoCount") } def count(insnList: InsnList, opcode: Int): Int = { diff --git a/test/pending/pos/inliner2.flags b/test/pending/pos/inliner2.flags new file mode 100644 index 0000000000..4bf93a9c2a --- /dev/null +++ b/test/pending/pos/inliner2.flags @@ -0,0 +1,35 @@ +-optimise -Ybackend:GenASM -Xfatal-warnings +/* +This is what we get with 2.11.2-M3 and -Yopt:l:project: + + public final int bob1(); + Code: + 0: aload_0 + 1: aload_0 + 2: astore 6 + 4: aload 6 + 6: invokedynamic #62, 0 // InvokeDynamic #0:apply$mcZ$sp:(LA;)Lscala/runtime/java8/JFunction0$mcZ$sp; + 11: checkcast #29 // class scala/Function0 + 14: invokedynamic #71, 0 // InvokeDynamic #1:apply$mcI$sp:()Lscala/runtime/java8/JFunction0$mcI$sp; + 19: checkcast #29 // class scala/Function0 + 22: invokedynamic #76, 0 // InvokeDynamic #2:apply$mcI$sp:()Lscala/runtime/java8/JFunction0$mcI$sp; + 27: checkcast #29 // class scala/Function0 + 30: astore 4 + 32: astore_3 + 33: astore_2 + 34: astore_1 + 35: aload_2 + 36: pop + 37: aload 6 + 39: invokevirtual #53 // Method A$$$anonfun$1:()Z + 42: ifeq 54 + 45: aload_3 + 46: invokeinterface #36, 1 // InterfaceMethod scala/Function0.apply:()Ljava/lang/Object; + 51: goto 61 + 54: aload 4 + 56: invokeinterface #36, 1 // InterfaceMethod scala/Function0.apply:()Ljava/lang/Object; + 61: astore 5 + 63: aload 5 + 65: invokestatic #82 // Method scala/runtime/BoxesRunTime.unboxToInt:(Ljava/lang/Object;)I + 68: ireturn +*/
\ No newline at end of file diff --git a/test/files/pos/inliner2.scala b/test/pending/pos/inliner2.scala index bc83e04312..bc83e04312 100644 --- a/test/files/pos/inliner2.scala +++ b/test/pending/pos/inliner2.scala diff --git a/test/pending/pos/sealed-final.flags b/test/pending/pos/sealed-final.flags new file mode 100644 index 0000000000..63d024a0ba --- /dev/null +++ b/test/pending/pos/sealed-final.flags @@ -0,0 +1,41 @@ +-Xfatal-warnings -Yinline-warnings -Ybackend:GenASM -optimise +/* +The new flag settings could be + -Yopt-warnings -Yopt:l:project + +The issue here is that things are being inlined, but a lot of +redundant load/store instructions are left behind: + +2.11.7: + + public int f(); + Code: + 0: getstatic #19 // Field Foo$.MODULE$:LFoo$; + 3: invokevirtual #23 // Method Foo$.mkFoo:()LFoo; + 6: pop + 7: bipush 10 + 9: iconst_1 + 10: iadd + 11: ireturn + + +2.12.0-M3: + + public int f(); + Code: + 0: getstatic #19 // Field Foo$.MODULE$:LFoo$; + 3: invokevirtual #23 // Method Foo$.mkFoo:()LFoo; + 6: bipush 10 + 8: istore_2 + 9: dup + 10: ifnonnull 15 + 13: aconst_null + 14: athrow + 15: astore_1 + 16: iload_2 + 17: iconst_1 + 18: iadd + 19: istore_3 + 20: iload_3 + 21: ireturn +*/
\ No newline at end of file diff --git a/test/files/pos/sealed-final.scala b/test/pending/pos/sealed-final.scala index bdedb5c1f6..bdedb5c1f6 100644 --- a/test/files/pos/sealed-final.scala +++ b/test/pending/pos/sealed-final.scala diff --git a/test/files/run/inline-ex-handlers.check b/test/pending/run/inline-ex-handlers.check index 36fc2eefa4..fce32771b4 100644 --- a/test/files/run/inline-ex-handlers.check +++ b/test/pending/run/inline-ex-handlers.check @@ -7,7 +7,7 @@ startBlock: 1 - blocks: [1,2,3,4] + blocks: [1,3,4] - + @@ -186,2 +186,4 @@ 92 LOAD_LOCAL(value x$1) + 92 STORE_LOCAL(variable boxed1) @@ -16,19 +16,19 @@ @@ -194,5 +196,2 @@ 92 CALL_METHOD MyException.message (dynamic) - 92 JUMP 2 -- -- 2: +- +- 2: 92 RETURN(REF(class Object)) @@ -246,3 +245,3 @@ startBlock: 1 - blocks: [1,2,3,4,5,6,7,8,11,12,13,14,15,16,17,18] + blocks: [1,2,3,4,5,6,8,11,12,13,14,15,16,17,18] - + @@ -257,5 +256,2 @@ 92 SCOPE_ENTER value x1 - 92 JUMP 7 -- -- 7: +- +- 7: 92 LOAD_LOCAL(value x1) @@ -408,5 +404,5 @@ def main(args: Array[String] (ARRAY[REF(class String)])): Unit { @@ -37,27 +37,27 @@ startBlock: 1 - blocks: [1,2,3,4,5,8,10,11,13] + blocks: [1,2,3,5,8,10,11,13,14] - + @@ -434,4 +430,13 @@ 103 CALL_METHOD MyException.<init> (static-instance) - 103 THROW(MyException) + ? STORE_LOCAL(value ex6) + ? JUMP 14 - -+ 14: + ++ 14: + 101 LOAD_LOCAL(value ex6) + 101 STORE_LOCAL(value x4) + 101 SCOPE_ENTER value x4 + 106 LOAD_LOCAL(value x4) + 106 IS_INSTANCE REF(class MyException) + 106 CZJUMP (BOOL)NE ? 5 : 8 -+ - 13: ++ + 13: @@ -447,5 +452,2 @@ 101 SCOPE_ENTER value x4 - 101 JUMP 4 -- -- 4: +- +- 4: 106 LOAD_LOCAL(value x4) @@ -459,8 +461,5 @@ 106 SCOPE_ENTER value x5 @@ -74,43 +74,43 @@ startBlock: 1 - blocks: [1,2,3,4,6,7,9,10] + blocks: [1,3,4,6,7,9,10,11,12,13] - + @@ -565,4 +564,9 @@ 306 CALL_METHOD MyException.<init> (static-instance) - 306 THROW(MyException) + ? JUMP 11 - -+ 11: + ++ 11: + ? LOAD_LOCAL(variable monitor4) + 305 MONITOR_EXIT + ? JUMP 12 -+ - 9: ++ + 9: @@ -571,3 +575,3 @@ 305 MONITOR_EXIT - ? THROW(Throwable) + ? JUMP 12 - + @@ -577,4 +581,11 @@ 304 MONITOR_EXIT - ? THROW(Throwable) + ? STORE_LOCAL(value t) + ? JUMP 13 - -+ 12: + ++ 12: + ? LOAD_LOCAL(variable monitor3) + 304 MONITOR_EXIT + ? STORE_LOCAL(value t) + ? JUMP 13 -+ - 3: ++ + 3: @@ -591,5 +602,14 @@ 310 CALL_METHOD scala.Predef.println (dynamic) - 310 JUMP 2 + 300 RETURN(UNIT) - -- 2: -+ 13: + +- 2: ++ 13: + 310 LOAD_MODULE object Predef + 310 CALL_PRIMITIVE(StartConcat) + 310 CONSTANT("Caught crash: ") @@ -134,28 +134,28 @@ startBlock: 1 - blocks: [1,3,4,5,6,8,9] + blocks: [1,3,4,5,6,8,9,10,11] - + @@ -660,4 +680,10 @@ 78 CALL_METHOD java.lang.IllegalArgumentException.<init> (static-instance) - 78 THROW(IllegalArgumentException) + ? STORE_LOCAL(value e) + ? JUMP 10 - -+ 10: + ++ 10: + 81 LOAD_LOCAL(value e) + ? STORE_LOCAL(variable exc1) + ? JUMP 11 -+ - 8: ++ + 8: @@ -686,3 +712,4 @@ 81 LOAD_LOCAL(value e) - 81 THROW(Exception) + ? STORE_LOCAL(variable exc1) + ? JUMP 11 - + @@ -703,2 +730,15 @@ - -+ 11: + ++ 11: + 83 LOAD_MODULE object Predef + 83 CONSTANT("finally") + 83 CALL_METHOD scala.Predef.println (dynamic) @@ -167,7 +167,7 @@ + 84 STORE_LOCAL(variable result) + 84 LOAD_LOCAL(variable exc1) + 84 THROW(Throwable) -+ ++ } @@ -708,3 +748,3 @@ with finalizer: null @@ -181,20 +181,20 @@ startBlock: 1 - blocks: [1,3,4,5,6,9,13,14,15,18,20,21,23,24] + blocks: [1,3,4,5,6,9,13,14,15,18,20,21,23,24,25,26,27] - + @@ -758,4 +798,11 @@ 172 CALL_METHOD MyException.<init> (static-instance) - 172 THROW(MyException) + ? STORE_LOCAL(value ex6) + ? JUMP 25 - -+ 25: + ++ 25: + 170 LOAD_LOCAL(value ex6) + 170 STORE_LOCAL(value x4) + 170 SCOPE_ENTER value x4 + 170 JUMP 14 -+ - 23: ++ + 23: @@ -798,8 +845,5 @@ 175 SCOPE_ENTER value x5 - 175 LOAD_LOCAL(value x5) @@ -215,22 +215,22 @@ - 177 THROW(MyException) + ? STORE_LOCAL(value ex6) + ? JUMP 26 - + @@ -813,3 +859,4 @@ 170 LOAD_LOCAL(value ex6) - 170 THROW(Throwable) + ? STORE_LOCAL(value ex6) + ? JUMP 26 - + @@ -823,2 +870,8 @@ - -+ 26: + ++ 26: + 169 LOAD_LOCAL(value ex6) + 169 STORE_LOCAL(value x4) + 169 SCOPE_ENTER value x4 + 169 JUMP 5 -+ - 5: ++ + 5: @@ -833,8 +886,5 @@ 180 SCOPE_ENTER value x5 - 180 LOAD_LOCAL(value x5) @@ -251,16 +251,16 @@ - 182 THROW(MyException) + ? STORE_LOCAL(variable exc2) + ? JUMP 27 - + @@ -848,3 +900,4 @@ 169 LOAD_LOCAL(value ex6) - 169 THROW(Throwable) + ? STORE_LOCAL(variable exc2) + ? JUMP 27 - + @@ -865,2 +918,15 @@ - -+ 27: + ++ 27: + 184 LOAD_MODULE object Predef + 184 CONSTANT("finally") + 184 CALL_METHOD scala.Predef.println (dynamic) @@ -272,7 +272,7 @@ + 185 STORE_LOCAL(variable result) + 185 LOAD_LOCAL(variable exc2) + 185 THROW(Throwable) -+ ++ } @@ -870,6 +936,6 @@ with finalizer: null @@ -290,20 +290,20 @@ startBlock: 1 - blocks: [1,2,3,6,7,8,11,13,14,16] + blocks: [1,2,3,6,7,8,11,13,14,16,17] - + @@ -923,4 +989,11 @@ 124 CALL_METHOD MyException.<init> (static-instance) - 124 THROW(MyException) + ? STORE_LOCAL(value ex6) + ? JUMP 17 - -+ 17: + ++ 17: + 122 LOAD_LOCAL(value ex6) + 122 STORE_LOCAL(value x4) + 122 SCOPE_ENTER value x4 + 122 JUMP 7 -+ - 16: ++ + 16: @@ -948,8 +1021,5 @@ 127 SCOPE_ENTER value x5 - 127 LOAD_LOCAL(value x5) @@ -327,27 +327,27 @@ startBlock: 1 - blocks: [1,2,3,4,5,8,12,13,14,16] + blocks: [1,2,3,5,8,12,13,14,16,17] - + @@ -1032,4 +1102,13 @@ 148 CALL_METHOD MyException.<init> (static-instance) - 148 THROW(MyException) + ? STORE_LOCAL(value ex6) + ? JUMP 17 - -+ 17: + ++ 17: + 145 LOAD_LOCAL(value ex6) + 145 STORE_LOCAL(value x4) + 145 SCOPE_ENTER value x4 + 154 LOAD_LOCAL(value x4) + 154 IS_INSTANCE REF(class MyException) + 154 CZJUMP (BOOL)NE ? 5 : 8 -+ - 16: ++ + 16: @@ -1053,5 +1132,2 @@ 145 SCOPE_ENTER value x4 - 145 JUMP 4 -- -- 4: +- +- 4: 154 LOAD_LOCAL(value x4) @@ -1065,8 +1141,5 @@ 154 SCOPE_ENTER value x5 @@ -364,20 +364,20 @@ startBlock: 1 - blocks: [1,2,3,4,5,7] + blocks: [1,2,3,4,5,7,8] - + @@ -1311,4 +1384,11 @@ 38 CALL_METHOD java.lang.IllegalArgumentException.<init> (static-instance) - 38 THROW(IllegalArgumentException) + ? STORE_LOCAL(value e) + ? JUMP 8 - -+ 8: + ++ 8: + 42 LOAD_MODULE object Predef + 42 CONSTANT("IllegalArgumentException") + 42 CALL_METHOD scala.Predef.println (dynamic) + 42 JUMP 2 -+ - 7: ++ + 7: @@ -1358,5 +1438,5 @@ def main(args: Array[String] (ARRAY[REF(class String)])): Unit { - locals: value args, variable result, value ex6, value x4, value x5, value message, value x @@ -385,33 +385,33 @@ startBlock: 1 - blocks: [1,2,3,4,5,8,10,11,13,14,16] + blocks: [1,2,3,5,8,10,11,13,14,16,17] - + @@ -1384,3 +1464,4 @@ 203 CALL_METHOD MyException.<init> (static-instance) - 203 THROW(MyException) + ? STORE_LOCAL(value ex6) + ? JUMP 17 - + @@ -1404,4 +1485,13 @@ 209 CALL_METHOD MyException.<init> (static-instance) - 209 THROW(MyException) + ? STORE_LOCAL(value ex6) + ? JUMP 17 - -+ 17: + ++ 17: + 200 LOAD_LOCAL(value ex6) + 200 STORE_LOCAL(value x4) + 200 SCOPE_ENTER value x4 + 212 LOAD_LOCAL(value x4) + 212 IS_INSTANCE REF(class MyException) + 212 CZJUMP (BOOL)NE ? 5 : 8 -+ - 16: ++ + 16: @@ -1417,5 +1507,2 @@ 200 SCOPE_ENTER value x4 - 200 JUMP 4 -- -- 4: +- +- 4: 212 LOAD_LOCAL(value x4) @@ -1429,8 +1516,5 @@ 212 SCOPE_ENTER value x5 @@ -428,41 +428,41 @@ startBlock: 1 - blocks: [1,2,3,4,5,7] + blocks: [1,2,3,4,5,7,8] - + @@ -1502,4 +1586,11 @@ 58 CALL_METHOD java.lang.IllegalArgumentException.<init> (static-instance) - 58 THROW(IllegalArgumentException) + ? STORE_LOCAL(value e) + ? JUMP 8 - -+ 8: + ++ 8: + 62 LOAD_MODULE object Predef + 62 CONSTANT("RuntimeException") + 62 CALL_METHOD scala.Predef.println (dynamic) + 62 JUMP 2 -+ - 7: ++ + 7: @@ -1551,3 +1642,3 @@ startBlock: 1 - blocks: [1,3,4] + blocks: [1,3,4,5] - + @@ -1571,4 +1662,9 @@ 229 CALL_METHOD MyException.<init> (static-instance) - 229 THROW(MyException) + ? JUMP 5 - -+ 5: + ++ 5: + ? LOAD_LOCAL(variable monitor1) + 228 MONITOR_EXIT + 228 THROW(Throwable) -+ - 3: ++ + 3: @@ -1577,3 +1673,3 @@ 228 MONITOR_EXIT - ? THROW(Throwable) + 228 THROW(Throwable) - + @@ -1605,5 +1701,5 @@ def main(args: Array[String] (ARRAY[REF(class String)])): Unit { - locals: value args, variable result, variable monitor2, variable monitorResult1 @@ -470,7 +470,7 @@ startBlock: 1 - blocks: [1,3,4] + blocks: [1,3,4,5] - + @@ -1630,4 +1726,12 @@ 245 CALL_METHOD MyException.<init> (static-instance) - 245 THROW(MyException) @@ -478,15 +478,14 @@ + ? DROP ConcatClass + ? LOAD_LOCAL(value exception$1) + ? JUMP 5 - -+ 5: + ++ 5: + ? LOAD_LOCAL(variable monitor2) + 244 MONITOR_EXIT + 244 THROW(Throwable) -+ - 3: ++ + 3: @@ -1636,3 +1740,3 @@ 244 MONITOR_EXIT - ? THROW(Throwable) + 244 THROW(Throwable) - diff --git a/test/files/run/inline-ex-handlers.scala b/test/pending/run/inline-ex-handlers.scala index 4095d54e36..964594d258 100644 --- a/test/files/run/inline-ex-handlers.scala +++ b/test/pending/run/inline-ex-handlers.scala @@ -1,7 +1,7 @@ import scala.tools.partest.IcodeComparison object Test extends IcodeComparison { - override def printIcodeAfterPhase = "inlinehandlers"; override def extraSettings: String = super.extraSettings + " -Ybackend:GenASM" // same line to minimize check file changs + override def printIcodeAfterPhase = "inlinehandlers" } import scala.util.Random._ diff --git a/test/files/run/t5313.check b/test/pending/run/t5313.check index 7a48b2b711..7a48b2b711 100644 --- a/test/files/run/t5313.check +++ b/test/pending/run/t5313.check diff --git a/test/files/run/t5313.scala b/test/pending/run/t5313.scala index 24ed334816..4a5b076e6e 100644 --- a/test/files/run/t5313.scala +++ b/test/pending/run/t5313.scala @@ -3,7 +3,7 @@ import scala.tools.partest.IcodeComparison object Test extends IcodeComparison { override def printIcodeAfterPhase = "dce" - override def extraSettings: String = super.extraSettings + " -optimize -Ybackend:GenASM" + override def extraSettings: String = super.extraSettings + " -Yopt:l:classpath" override def code = """class Foo { diff --git a/test/files/run/t6955.scala b/test/pending/run/t6955.scala index 9ee3ef6bc5..787617eff1 100644 --- a/test/files/run/t6955.scala +++ b/test/pending/run/t6955.scala @@ -21,8 +21,6 @@ class Switches { } object Test extends IcodeComparison { - override def extraSettings: String = super.extraSettings + " -Ybackend:GenASM" - // ensure we get two switches out of this -- ignore the rest of the output for robustness // exclude the constant we emit for the "SWITCH ..." string below (we get the icode for all the code you see in this file) override def show() = { @@ -30,7 +28,6 @@ object Test extends IcodeComparison { val actual = (collectIcode() filter { x => x.indexOf("SWITCH ...") >= 0 && x.indexOf("CONSTANT(") == -1 }).size - assert(actual == expected) + assert(actual == expected, s"switches expected: $expected, actual: $actual") } } - diff --git a/test/files/run/t6956.scala b/test/pending/run/t6956.scala index 594f5c9194..57d721807d 100644 --- a/test/files/run/t6956.scala +++ b/test/pending/run/t6956.scala @@ -19,8 +19,6 @@ class Switches { } object Test extends IcodeComparison { - override def extraSettings: String = super.extraSettings + " -Ybackend:GenASM" - // ensure we get two switches out of this -- ignore the rest of the output for robustness // exclude the constant we emit for the "SWITCH ..." string below (we get the icode for all the code you see in this file) override def show() = { @@ -28,6 +26,6 @@ object Test extends IcodeComparison { val actual = (collectIcode() filter { x => x.indexOf("SWITCH ...") >= 0 && x.indexOf("CONSTANT(") == -1 }).size - assert(actual == expected) + assert(actual == expected, s"switches expected: $expected, actual: $actual") } } diff --git a/test/files/run/test-cpp.check b/test/pending/run/test-cpp.check index 40c10e3350..ff4c9bf2bf 100644 --- a/test/files/run/test-cpp.check +++ b/test/pending/run/test-cpp.check @@ -6,7 +6,7 @@ + locals: value args startBlock: 1 @@ -59,10 +59,6 @@ - 1: + 1: - 52 CONSTANT(2) - 52 STORE_LOCAL(value x) 52 SCOPE_ENTER value x @@ -37,7 +37,7 @@ + locals: value args startBlock: 1 @@ -157,10 +151,6 @@ - 1: + 1: - 66 THIS(TestAliasChainDerefThis) - 66 STORE_LOCAL(value x) 66 SCOPE_ENTER value x @@ -54,7 +54,7 @@ + locals: value x startBlock: 1 @@ -198,7 +188,5 @@ - 1: + 1: - 29 LOAD_LOCAL(value x) - 29 STORE_LOCAL(value y) 29 SCOPE_ENTER value y diff --git a/test/files/run/test-cpp.scala b/test/pending/run/test-cpp.scala index 80163deb66..4fca67d51e 100644 --- a/test/files/run/test-cpp.scala +++ b/test/pending/run/test-cpp.scala @@ -15,7 +15,7 @@ import scala.tools.partest.IcodeComparison object Test extends IcodeComparison { - override def printIcodeAfterPhase = "dce"; override def extraSettings: String = super.extraSettings + " -Ybackend:GenASM" // same line to minimize check file changs + override def printIcodeAfterPhase = "dce" } import scala.util.Random._ diff --git a/test/scaladoc/javascript/test-index.html b/test/scaladoc/javascript/test-index.html index 42cbc8cc09..91756b5be1 100644 --- a/test/scaladoc/javascript/test-index.html +++ b/test/scaladoc/javascript/test-index.html @@ -6,7 +6,6 @@ src="http://code.jquery.com/qunit/git/qunit.js"></script> <script type="text/javascript" src="../../../src/compiler/scala/tools/nsc/doc/html/resource/lib/jquery.js"></script> - <script src="../../../src/compiler/scala/tools/nsc/doc/html/resource/lib/jquery.layout.js"></script> <script src="../../../src/compiler/scala/tools/nsc/doc/html/resource/lib/scheduler.js"></script> <script type="text/javascript" src="../../../src/compiler/scala/tools/nsc/doc/html/resource/lib/index.js"></script> diff --git a/test/scaladoc/resources/links.scala b/test/scaladoc/resources/links.scala index ecac9c63cf..8e000ab979 100644 --- a/test/scaladoc/resources/links.scala +++ b/test/scaladoc/resources/links.scala @@ -1,6 +1,6 @@ // that would be: // SI-5079 "Scaladoc can't link to an object (only a class or trait)" -// SI-4497 "Links in ScalaDoc - Spec and implementation unsufficient" +// SI-4497 "Links in Scaladoc - Spec and implementation unsufficient" // SI-4224 "Wiki-links should support method targets" // SI-3695 "support non-fully-qualified type links in scaladoc comments" // SI-6487 "Scaladoc can't link to inner classes" diff --git a/test/scaladoc/run/links.scala b/test/scaladoc/run/links.scala index 64441c2d95..01db66aec3 100644 --- a/test/scaladoc/run/links.scala +++ b/test/scaladoc/run/links.scala @@ -3,7 +3,7 @@ import scala.tools.nsc.doc.model._ import scala.tools.partest.ScaladocModelTest // SI-5079 "Scaladoc can't link to an object (only a class or trait)" -// SI-4497 "Links in ScalaDoc - Spec and implementation unsufficient" +// SI-4497 "Links in Scaladoc - Spec and implementation unsufficient" // SI-4224 "Wiki-links should support method targets" // SI-3695 "support non-fully-qualified type links in scaladoc comments" // SI-6487 "Scaladoc can't link to inner classes" |