@@ -549,6 +549,20 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma
549
549
}
550
550
}
551
551
552
+ def getStaticForwarderGenericSignature (sym : Symbol , moduleClass : Symbol ): String = {
553
+ // scala/bug#3452 Static forwarder generation uses the same erased signature as the method if forwards to.
554
+ // By rights, it should use the signature as-seen-from the module class, and add suitable
555
+ // primitive and value-class boxing/unboxing.
556
+ // But for now, just like we did in mixin, we just avoid writing a wrong generic signature
557
+ // (one that doesn't erase to the actual signature). See run/t3452b for a test case.
558
+
559
+ val memberTpe = ctx.atPhase(ctx.erasurePhase) { implicit ctx => moduleClass.denot.thisType.memberInfo(sym) }
560
+ val erasedMemberType = TypeErasure .erasure(memberTpe)
561
+ if (erasedMemberType =:= sym.denot.info)
562
+ getGenericSignature(sym, moduleClass, memberTpe).orNull
563
+ else null
564
+ }
565
+
552
566
private def getGenericSignature (sym : Symbol , owner : Symbol , memberTpe : Type )(implicit ctx : Context ): Option [String ] =
553
567
if (needsGenericSignature(sym)) {
554
568
val erasedTypeSym = sym.denot.info.typeSymbol
@@ -570,7 +584,6 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma
570
584
None
571
585
}
572
586
573
- def getStaticForwarderGenericSignature (sym : Symbol , moduleClass : Symbol ): String = null // todo: implement
574
587
575
588
576
589
def sourceFileFor (cu : CompilationUnit ): String = cu.source.file.name
0 commit comments