diff --git a/compiler/src/dotty/tools/dotc/typer/Namer.scala b/compiler/src/dotty/tools/dotc/typer/Namer.scala index a7dc9c6ee3b7..0c326cfc3735 100644 --- a/compiler/src/dotty/tools/dotc/typer/Namer.scala +++ b/compiler/src/dotty/tools/dotc/typer/Namer.scala @@ -1009,8 +1009,8 @@ class Namer { typer: Typer => case tp: TypeBounds => def recur(tp: Type): Type = tp match case tp: HKTypeLambda if !tp.isDeclaredVarianceLambda => - tp.withVariances(tp.paramNames.map(alwaysInvariant)) - .derivedLambdaType(resType = recur(tp.resType)) + val tp1 = tp.withVariances(tp.paramNames.map(alwaysInvariant)) + tp1.derivedLambdaType(resType = recur(tp1.resType)) case tp => tp tp.derivedTypeBounds(tp.lo, recur(tp.hi)) case _ => diff --git a/tests/pos/nestedLambdas.scala b/tests/pos/nestedLambdas.scala index 869c11bfc838..8cc0020dbfbb 100644 --- a/tests/pos/nestedLambdas.scala +++ b/tests/pos/nestedLambdas.scala @@ -10,11 +10,11 @@ class Test { val y: A[Int][Boolean] = x - def f[X <: T[Int]] = ??? + def f[X <: [Y] =>> T[Int][Y]] = ??? f[A[Int]] - def g[X <: T] = ??? + def g[X <: [Y] =>> [Z] =>> T[Y][Z]] = ??? g[A]