@@ -503,35 +503,33 @@ object Erasure extends TypeTestsCasts{
503
503
traverse(newStats, oldStats)
504
504
}
505
505
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
509
509
510
510
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" )
512
512
???
513
513
}
514
514
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
516
516
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" )
518
518
519
- val sel : Tree = This (currentClass).select(newDefSym .termRef)
519
+ val implSel : Tree = This (currentClass).select(implDefSym .termRef)
520
520
521
- val resultType = parentSym.info.widen.resultType
521
+ val bridgeResultType = parentSym.info.widen.resultType
522
522
523
523
val bridgeCtx = ctx.withOwner(bridge)
524
524
525
- tpd.DefDef (bridge, { paramss : List [List [tpd.Tree ]] =>
525
+ tpd.DefDef (bridge, { bridgeParamss : List [List [tpd.Tree ]] =>
526
526
implicit val ctx : Context = bridgeCtx
527
527
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)
535
533
})
536
534
}
537
535
0 commit comments