@@ -503,35 +503,33 @@ object Erasure extends TypeTestsCasts{
503503 traverse(newStats, oldStats)
504504 }
505505
506- def makeBridgeDef (newDef : tpd.DefDef , parentSym : Symbol )(implicit ctx : Context ): tpd.DefDef = {
507- val newDefSym = newDef .symbol
508- val currentClass = newDefSym .owner.asClass
506+ def makeBridgeDef (implDef : tpd.DefDef , parentSym : Symbol )(implicit ctx : Context ): tpd.DefDef = {
507+ val implDefSym = implDef .symbol
508+ val currentClass = implDefSym .owner.asClass
509509
510510 def error (reason : String ) = {
511- assert(false , s " failure creating bridge from ${newDefSym } to ${parentSym}, reason: $reason" )
511+ assert(false , s " failure creating bridge from ${implDefSym } to ${parentSym}, reason: $reason" )
512512 ???
513513 }
514514 val bridge = ctx.newSymbol(currentClass,
515- parentSym.name, parentSym.flags | Flags .Bridge , parentSym.info, coord = newDefSym .owner.coord).asTerm
515+ parentSym.name, parentSym.flags | Flags .Bridge , parentSym.info, coord = implDefSym .owner.coord).asTerm
516516 bridge.enteredAfter(ctx.phase.prev.asInstanceOf [DenotTransformer ]) // this should be safe, as we're executing in context of next phase
517- ctx.debuglog(s " generating bridge from ${newDefSym } to $bridge" )
517+ ctx.debuglog(s " generating bridge from ${implDefSym } to $bridge" )
518518
519- val sel : Tree = This (currentClass).select(newDefSym .termRef)
519+ val implSel : Tree = This (currentClass).select(implDefSym .termRef)
520520
521- val resultType = parentSym.info.widen.resultType
521+ val bridgeResultType = parentSym.info.widen.resultType
522522
523523 val bridgeCtx = ctx.withOwner(bridge)
524524
525- tpd.DefDef (bridge, { paramss : List [List [tpd.Tree ]] =>
525+ tpd.DefDef (bridge, { bridgeParamss : List [List [tpd.Tree ]] =>
526526 implicit val ctx : Context = bridgeCtx
527527
528- val rhs = paramss.foldLeft(sel)((fun, vparams) =>
529- fun.tpe.widen match {
530- case MethodType (names, types) => Apply (fun, (vparams, types).zipped.map(adapt(_, _, untpd.EmptyTree )))
531- case a => error(s " can not resolve apply type $a" )
532-
533- })
534- adapt(rhs, resultType)
528+ // Multiple parameter lists have been erased at this point
529+ val List (bridgeParams) = bridgeParamss
530+ val List (implParamTypes) = implSel.tpe.widen.paramTypess
531+ val rhs = Apply (implSel, (bridgeParams, implParamTypes).zipped.map(adapt(_, _, untpd.EmptyTree )))
532+ adapt(rhs, bridgeResultType)
535533 })
536534 }
537535
0 commit comments