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