diff --git a/compiler/src/dotty/tools/dotc/core/SymDenotations.scala b/compiler/src/dotty/tools/dotc/core/SymDenotations.scala index 0f94d52f5be9..beeaa2ee922e 100644 --- a/compiler/src/dotty/tools/dotc/core/SymDenotations.scala +++ b/compiler/src/dotty/tools/dotc/core/SymDenotations.scala @@ -2226,13 +2226,12 @@ object SymDenotations { def computeApplied = { btrCache(tp) = NoPrefix val baseTp = - if (tycon.typeSymbol eq symbol) tp - else (tycon.typeParams: @unchecked) match { + if (tycon.typeSymbol eq symbol) && !tycon.isLambdaSub then tp + else (tycon.typeParams: @unchecked) match case LambdaParam(_, _) :: _ => recur(tp.superType) case tparams: List[Symbol @unchecked] => recur(tycon).substApprox(tparams, args) - } record(tp, baseTp) baseTp } diff --git a/tests/pos/argDenot-alpakka.min.scala b/tests/pos/argDenot-alpakka.min.scala new file mode 100644 index 000000000000..0e509be59cfd --- /dev/null +++ b/tests/pos/argDenot-alpakka.min.scala @@ -0,0 +1,9 @@ +import scala.annotation.unchecked.uncheckedVariance as uV + +trait Test: + def test[S] = + val a: (([O] =>> Foo[O, S]) @uV)[Int] = ??? + a.m() + +class Foo[X, Y]: + def m(): Y = ??? diff --git a/tests/pos/argDenot-alpakka.scala b/tests/pos/argDenot-alpakka.scala new file mode 100644 index 000000000000..41d6ad52ac97 --- /dev/null +++ b/tests/pos/argDenot-alpakka.scala @@ -0,0 +1,21 @@ +import scala.annotation.unchecked.uncheckedVariance as uV + +trait Test: + def split[I, M](in: Flow[I, Byte, M]): SubFlow[Byte, M, in.Repr] + def test = + split(new Flow[Int, Byte, Unit]) + .via[Char] + .merge + .filter() + +trait FlowOps[+Out, +Mat]: + type Repr[+O] <: FlowOps[O, Mat] { type Repr[+O] = FlowOps.this.Repr[O] } + def via[O]: Repr[O] = ??? + def filter(): Repr[Out] = ??? + +class Flow[-In, +Out, +Mat] extends FlowOps[Out, Mat]: + type Repr[+O] = Flow[In @uV, O, Mat @uV] + +class SubFlow[+Out, +Mat, +F[+_]] extends FlowOps[Out, Mat]: + type Repr[+O] = SubFlow[O, Mat @uV, F @uV] + def merge: F[Out] = ???