diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2016-08-02 11:43:36 -0700 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2016-08-15 14:34:51 +1000 |
commit | 40f7fce0af1da614d99048b024e1ff579635f0f2 (patch) | |
tree | e0471e7302da2291edb14a43a32bb0073e25aee4 /test | |
parent | 804133f60dd3c78909dc9e557e91b5c9923240ff (diff) | |
download | scala-40f7fce0af1da614d99048b024e1ff579635f0f2.tar.gz scala-40f7fce0af1da614d99048b024e1ff579635f0f2.tar.bz2 scala-40f7fce0af1da614d99048b024e1ff579635f0f2.zip |
SD-192 Change scheme for trait super accessors
Rather than putting the code of a trait method body into a static method,
leave it in the default method. The static method (needed as the target
of the super calls) now uses `invokespecial` to exactly call that method.
Diffstat (limited to 'test')
4 files changed, 13 insertions, 13 deletions
diff --git a/test/junit/scala/collection/mutable/OpenHashMapTest.scala b/test/junit/scala/collection/mutable/OpenHashMapTest.scala index b6cddf2101..90f6be6ee5 100644 --- a/test/junit/scala/collection/mutable/OpenHashMapTest.scala +++ b/test/junit/scala/collection/mutable/OpenHashMapTest.scala @@ -1,6 +1,6 @@ package scala.collection.mutable -import org.junit.Test +import org.junit.{Ignore, Test} import org.junit.Assert._ import org.junit.runner.RunWith import org.junit.runners.JUnit4 diff --git a/test/junit/scala/tools/nsc/backend/jvm/BytecodeTest.scala b/test/junit/scala/tools/nsc/backend/jvm/BytecodeTest.scala index 5904cb2441..b09a41969e 100644 --- a/test/junit/scala/tools/nsc/backend/jvm/BytecodeTest.scala +++ b/test/junit/scala/tools/nsc/backend/jvm/BytecodeTest.scala @@ -169,7 +169,7 @@ class BytecodeTest extends BytecodeTesting { assertEquals(x.end, labels(7)) } - @Test // wrong line numbers for rewritten `this` references in trait static methods + @Test def sd186_traitLineNumber(): Unit = { val code = """trait T { @@ -182,9 +182,9 @@ class BytecodeTest extends BytecodeTesting { val t = compileClass(code) val tMethod = getMethod(t, "t$") val invoke = Invoke(INVOKEVIRTUAL, "java/lang/Object", "toString", "()Ljava/lang/String;", false) + // ths static accessor is positioned at the line number of the accessed method. assertSameCode(tMethod.instructions, - List(Label(0), LineNumber(3, Label(0)), VarOp(ALOAD, 0), invoke, Op(POP), - Label(5), LineNumber(4, Label(5)), VarOp(ALOAD, 0), invoke, Op(POP), Op(RETURN), Label(11)) + List(Label(0), LineNumber(2, Label(0)), VarOp(ALOAD, 0), Invoke(INVOKESPECIAL, "T", "t", "()V", true), Op(RETURN), Label(4)) ) } } diff --git a/test/junit/scala/tools/nsc/backend/jvm/opt/InlinerSeparateCompilationTest.scala b/test/junit/scala/tools/nsc/backend/jvm/opt/InlinerSeparateCompilationTest.scala index 85df42e069..a2513cacdc 100644 --- a/test/junit/scala/tools/nsc/backend/jvm/opt/InlinerSeparateCompilationTest.scala +++ b/test/junit/scala/tools/nsc/backend/jvm/opt/InlinerSeparateCompilationTest.scala @@ -97,7 +97,7 @@ class InlinerSeparateCompilationTest { """.stripMargin val List(a, t) = compileClassesSeparately(List(codeA, assembly), args) - assertNoInvoke(getMethod(t, "f$")) - assertNoInvoke(getMethod(a, "n$")) + assertNoInvoke(getMethod(t, "f")) + assertNoInvoke(getMethod(a, "n")) } } diff --git a/test/junit/scala/tools/nsc/backend/jvm/opt/InlinerTest.scala b/test/junit/scala/tools/nsc/backend/jvm/opt/InlinerTest.scala index 539c66a0d5..29a23df784 100644 --- a/test/junit/scala/tools/nsc/backend/jvm/opt/InlinerTest.scala +++ b/test/junit/scala/tools/nsc/backend/jvm/opt/InlinerTest.scala @@ -518,7 +518,7 @@ class InlinerTest extends BytecodeTesting { val List(c, oMirror, oModule, t) = compile(code, allowMessage = i => {count += 1; i.msg contains warn}) assert(count == 1, count) - assertNoInvoke(getMethod(t, "f$")) + assertNoInvoke(getMethod(t, "f")) assertNoInvoke(getMethod(c, "t1")) assertNoInvoke(getMethod(c, "t2")) @@ -544,9 +544,9 @@ class InlinerTest extends BytecodeTesting { val List(assembly, c, t) = compile(code) - assertNoInvoke(getMethod(t, "f$")) + assertNoInvoke(getMethod(t, "f")) - assertNoInvoke(getMethod(assembly, "n$")) + assertNoInvoke(getMethod(assembly, "n")) assertNoInvoke(getMethod(c, "t1")) assertNoInvoke(getMethod(c, "t2")) @@ -622,8 +622,8 @@ class InlinerTest extends BytecodeTesting { val List(ca, cb, t1, t2a, t2b) = compile(code, allowMessage = i => {count += 1; i.msg contains warning}) assert(count == 4, count) // see comments, f is not inlined 4 times - assertNoInvoke(getMethod(t2a, "g2a$")) - assertInvoke(getMethod(t2b, "g2b$"), "T1", "f") + assertNoInvoke(getMethod(t2a, "g2a")) + assertInvoke(getMethod(t2b, "g2b"), "T1", "f") assertInvoke(getMethod(ca, "m1a"), "T1", "f") assertNoInvoke(getMethod(ca, "m2a")) // no invoke, see comment on def g2a @@ -682,8 +682,8 @@ class InlinerTest extends BytecodeTesting { |} """.stripMargin val List(c, t) = compile(code) - val t1 = getMethod(t, "t1$") - val t2 = getMethod(t, "t2$") + val t1 = getMethod(t, "t1") + val t2 = getMethod(t, "t2") val cast = TypeOp(CHECKCAST, "C") Set(t1, t2).foreach(m => assert(m.instructions.contains(cast), m.instructions)) } |