summaryrefslogtreecommitdiff
path: root/test/junit/scala/tools/nsc/backend/jvm/opt/BTypesFromClassfileTest.scala
diff options
context:
space:
mode:
authorLukas Rytz <lukas.rytz@gmail.com>2016-04-12 10:59:58 +0200
committerLukas Rytz <lukas.rytz@gmail.com>2016-04-20 08:53:52 +0200
commit3fca034c51dd159ff077fdde7e3146b1e41cc925 (patch)
treeb68c166936621fe13a3ded46b36408ecb4db52de /test/junit/scala/tools/nsc/backend/jvm/opt/BTypesFromClassfileTest.scala
parent765eb29a769488d56f9ff2e4dde105961dbd55db (diff)
downloadscala-3fca034c51dd159ff077fdde7e3146b1e41cc925.tar.gz
scala-3fca034c51dd159ff077fdde7e3146b1e41cc925.tar.bz2
scala-3fca034c51dd159ff077fdde7e3146b1e41cc925.zip
Ensure ClassBTypes constructed from symbol and classfile are identical
A super call (invokespecial) to a default method T.m is only allowed if the interface T is a direct parent of the class. Super calls are introduced for example in Mixin when generating forwarder methods: trait T { override def clone(): Object = "hi" } trait U extends T class C extends U The class C gets a forwarder that invokes T.clone(). During code generation the interface T is added as direct parent to class C. Note that T is not a (direct) parent in the frontend type of class C. This commit stores interfaces that are added to a class during code generation in the InlineInfo classfile attribute. This allows filtering the interface list when constructing a ClassBType from a classfile.
Diffstat (limited to 'test/junit/scala/tools/nsc/backend/jvm/opt/BTypesFromClassfileTest.scala')
-rw-r--r--test/junit/scala/tools/nsc/backend/jvm/opt/BTypesFromClassfileTest.scala14
1 files changed, 1 insertions, 13 deletions
diff --git a/test/junit/scala/tools/nsc/backend/jvm/opt/BTypesFromClassfileTest.scala b/test/junit/scala/tools/nsc/backend/jvm/opt/BTypesFromClassfileTest.scala
index 1ce913006d..9e6a148dba 100644
--- a/test/junit/scala/tools/nsc/backend/jvm/opt/BTypesFromClassfileTest.scala
+++ b/test/junit/scala/tools/nsc/backend/jvm/opt/BTypesFromClassfileTest.scala
@@ -67,19 +67,7 @@ class BTypesFromClassfileTest {
// there's a separate InlineInfoTest.
val chk1 = sameBTypes(fromSym.superClass, fromClassfile.superClass, checked)
-
- // was:
- // val chk2 = sameBTypes(fromSym.interfaces, fromClassfile.interfaces, chk1)
-
- // TODO: The new trait encoding emits redundant parents in the backend to avoid linkage errors in invokespecial
- // Need to give this some more thought, maybe do it earlier so it is reflected in the Symbol's info, too.
- val fromSymInterfaces = fromSym.interfaces
- val fromClassFileInterfaces = fromClassfile.interfaces
- val (matching, other) = fromClassFileInterfaces.partition(x => fromSymInterfaces.exists(_.internalName == x.internalName))
- val chk2 = sameBTypes(fromSym.interfaces, matching, chk1)
- for (redundant <- other) {
- assert(matching.exists(x => x.isSubtypeOf(redundant).orThrow), redundant)
- }
+ val chk2 = sameBTypes(fromSym.interfaces, fromClassfile.interfaces, chk1)
// The fromSym info has only member classes, no local or anonymous. The symbol is read from the
// Scala pickle data and only member classes are created / entered.