@@ -764,7 +764,13 @@ class Inliner(call: tpd.Tree, rhsToInline: tpd.Tree)(using Context) {
764764 for (param <- tpe.cls.typeParams)
765765 paramProxy(param.typeRef) = adaptToPrefix(param.typeRef)
766766 case tpe : NamedType
767- if tpe.symbol.is(Param ) && tpe.symbol.owner == inlinedMethod && ! paramProxy.contains(tpe) =>
767+ if tpe.symbol.is(Param )
768+ && tpe.symbol.owner == inlinedMethod
769+ && (tpe.symbol.isTerm || inlinedMethod.paramSymss.exists(_.contains(tpe.symbol)))
770+ // this test is needed to rule out nested LambdaTypeTree parameters
771+ // with the same name as the method's parameters. Note that the nested
772+ // LambdaTypeTree parameters also have the inlineMethod as owner. C.f. i13460.scala.
773+ && ! paramProxy.contains(tpe) =>
768774 paramBinding.get(tpe.name) match
769775 case Some (bound) => paramProxy(tpe) = bound
770776 case _ => // can happen for params bound by type-lambda trees.
@@ -960,6 +966,11 @@ class Inliner(call: tpd.Tree, rhsToInline: tpd.Tree)(using Context) {
960966 substTo = Nil
961967 )(using inlineCtx)
962968
969+ inlining.println(
970+ i """ inliner transform with
971+ |thisProxy = ${thisProxy.toList.map(_._1)}%, % --> ${thisProxy.toList.map(_._2)}%, %
972+ |paramProxy = ${paramProxy.toList.map(_._1.typeSymbol.showLocated)}%, % --> ${paramProxy.toList.map(_._2)}%, % """ )
973+
963974 // Apply inliner to `rhsToInline`, split off any implicit bindings from result, and
964975 // make them part of `bindingsBuf`. The expansion is then the tree that remains.
965976 val expansion = inliner.transform(rhsToInline)
0 commit comments