@@ -764,7 +764,13 @@ class Inliner(call: tpd.Tree, rhsToInline: tpd.Tree)(using Context) {
764
764
for (param <- tpe.cls.typeParams)
765
765
paramProxy(param.typeRef) = adaptToPrefix(param.typeRef)
766
766
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) =>
768
774
paramBinding.get(tpe.name) match
769
775
case Some (bound) => paramProxy(tpe) = bound
770
776
case _ => // can happen for params bound by type-lambda trees.
@@ -960,6 +966,11 @@ class Inliner(call: tpd.Tree, rhsToInline: tpd.Tree)(using Context) {
960
966
substTo = Nil
961
967
)(using inlineCtx)
962
968
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
+
963
974
// Apply inliner to `rhsToInline`, split off any implicit bindings from result, and
964
975
// make them part of `bindingsBuf`. The expansion is then the tree that remains.
965
976
val expansion = inliner.transform(rhsToInline)
0 commit comments