Skip to content

Commit 488d31c

Browse files
committed
better assertion message, getSuperInterfaces()
1 parent 2725737 commit 488d31c

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

src/compiler/scala/tools/nsc/backend/jvm/BCodeTypes.scala

+18-2
Original file line numberDiff line numberDiff line change
@@ -1210,12 +1210,28 @@ abstract class BCodeTypes extends SubComponent with BytecodeWriters {
12101210
sups.distinct
12111211
};
12121212

1213-
assert(!superInterfaces.contains(NoSymbol), "found NoSymbol among: " + superInterfaces.mkString)
1214-
assert(superInterfaces.forall(s => s.isInterface || s.isTrait), "found non-interface among: " + superInterfaces.mkString)
1213+
def checkSuperIfaces() {
1214+
1215+
assert(!superInterfaces.contains(NoSymbol), s"found NoSymbol among: ${prettyPrintFullnames(superInterfaces)}")
1216+
1217+
val nonIfaces = superInterfaces.filter(s => !s.isInterface && !s.isTrait)
1218+
assert(
1219+
nonIfaces.isEmpty,
1220+
s"found non-interfaces ${prettyPrintFullnames(nonIfaces)} among: ${prettyPrintFullnames(superInterfaces)}"
1221+
)
1222+
1223+
}
1224+
1225+
checkSuperIfaces()
12151226

12161227
minimizeInterfaces(superInterfaces)
12171228
}
12181229

1230+
def prettyPrintFullnames(syms: List[Symbol]): String = {
1231+
val lst = mapWithIndex(syms)({ case (sym, idx) => s"( $idx : ${sym.fullName})" })
1232+
lst.mkString
1233+
}
1234+
12191235
final def exemplarIfExisting(iname: String): Tracked = {
12201236
val bt = lookupRefBTypeIfExisting(iname)
12211237
if(bt != null) exemplars.get(bt)

0 commit comments

Comments
 (0)