@@ -988,6 +988,18 @@ 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
+ if mt.paramInfos.nonEmpty && mt.paramInfos.last.isRepeatedParam then
995
+ val prefsR = prefss.head.reverse
996
+ val vararg = ctx.typeAssigner.seqToRepeated(prefsR.head)
997
+ val prefsR1 = vararg :: prefsR.tail
998
+ adaptForwarderParams(prefsR1.reverse :: acc, mt.resType, prefss.tail)
999
+ else
1000
+ adaptForwarderParams(prefss.head :: acc, mt.resType, prefss.tail)
1001
+ case _ =>
1002
+ acc.reverse ::: prefss
991
1003
if (whyNoForwarder(mbr) == " " ) {
992
1004
val sym = mbr.symbol
993
1005
val forwarder =
@@ -1024,7 +1036,8 @@ class Namer { typer: Typer =>
1024
1036
import tpd ._
1025
1037
val ref = path.select(sym.asTerm)
1026
1038
val ddef = tpd.polyDefDef(forwarder.asTerm, targs => prefss =>
1027
- ref.appliedToTypes(targs).appliedToArgss(prefss)
1039
+ ref.appliedToTypes(targs)
1040
+ .appliedToArgss(adaptForwarderParams(Nil , sym.info.stripPoly, prefss))
1028
1041
)
1029
1042
if forwarder.isInlineMethod then
1030
1043
PrepareInlineable .registerInlineInfo(forwarder, ddef.rhs)
0 commit comments