@@ -988,6 +988,20 @@ class Namer { typer: Typer =>
988
988
* provided `mbr` is accessible and of the right implicit/non-implicit kind.
989
989
*/
990
990
def addForwarder (alias : TermName , mbr : SingleDenotation , span : Span ): Unit =
991
+ def adaptForwarderParams (acc : List [List [tpd.Tree ]], tp : Type , prefss : List [List [tpd.Tree ]])
992
+ : List [List [tpd.Tree ]] = tp match
993
+ case mt : MethodType =>
994
+ // Note: in this branch we use the assumptions
995
+ // that `prefss.head` corresponds to `mt.paramInfos` and
996
+ // that `prefss.tail` corresponds to `mt.resType`
997
+ if mt.paramInfos.nonEmpty && mt.paramInfos.last.isRepeatedParam then
998
+ val init :+ vararg = prefss.head
999
+ val prefs = init :+ ctx.typeAssigner.seqToRepeated(vararg)
1000
+ adaptForwarderParams(prefs :: acc, mt.resType, prefss.tail)
1001
+ else
1002
+ adaptForwarderParams(prefss.head :: acc, mt.resType, prefss.tail)
1003
+ case _ =>
1004
+ acc.reverse ::: prefss
991
1005
if (whyNoForwarder(mbr) == " " ) {
992
1006
val sym = mbr.symbol
993
1007
val forwarder =
@@ -1024,7 +1038,8 @@ class Namer { typer: Typer =>
1024
1038
import tpd ._
1025
1039
val ref = path.select(sym.asTerm)
1026
1040
val ddef = tpd.polyDefDef(forwarder.asTerm, targs => prefss =>
1027
- ref.appliedToTypes(targs).appliedToArgss(prefss)
1041
+ ref.appliedToTypes(targs)
1042
+ .appliedToArgss(adaptForwarderParams(Nil , sym.info.stripPoly, prefss))
1028
1043
)
1029
1044
if forwarder.isInlineMethod then
1030
1045
PrepareInlineable .registerInlineInfo(forwarder, ddef.rhs)
0 commit comments