Closed
Description
Compiler version
3.2.0-RC1-bin-20220429-400427d-NIGHTLY
Works with 3.1.2
First bad commit fe40c59 in #14840
Minimized code
//> using scala "3.2.0-RC1-bin-20220429-400427d-NIGHTLY"
// //> using scala "3.1.2" // Last stable working version
case class Expr[+T](get: T)
trait Ctx[F[_]]
sealed trait Selector[F[_]]:
def appended(base: Expr[SelectLoop[F]]): Expr[SelectLoop[F]]
// Without Ctx[F] argument it would compile correctly
class SelectLoop[F[_]](using Ctx[F])
object SelectLoop:
def loopImpl[F[_]](ctx: Ctx[F])(caseDefs: List[Selector[F]]): Expr[Unit] =
// Adding explicit type :Expr[SelectLoop[F]] satifies the compiler
val s0 = Expr(new SelectLoop[F](using ctx))
val g = caseDefs.foldRight(s0)(_.appended(_))
Expr(())
Output
[error] ./test.scala:13:47: Found: (_$6 : Expr[Object])
[error] Required: Expr[SelectLoop[F]]
[error]
[error] where: F is a type in method loopImpl with bounds <: [_] =>> Any
[error] val g = caseDefs.foldRight(s0)(_.appended(_))
[error] ^
Expectation
Should compile like in the 3.1.2, without need for explicit type annotation