The problem comes from typer phase. If we use -Xprint:typer then we can see the problem:
def composeHandlingFuture[T >: Nothing <: Any](fut: scala.concurrent.Future[T], default: T): scala.concurrent.Future[T] = fut.recover[T](({
@SerialVersionUID(0) final <synthetic> class $anonfun extends scala.runtime.AbstractPartialFunction[Throwable,T] with Serializable {
/////// Init method //////
final override def applyOrElse[A1 >: Nothing <: Throwable, B1 >: T <: Any](x1: A1, default: A1 => B1): B1 = ((x1.asInstanceOf[Throwable]: Throwable): Throwable @unchecked) match {
case (e @ (_: Exception)) => <error: value default> // your argument comes here, but name clash happens
case (defaultCase$ @ _) => default.apply(x1)
};
//// IsDefinedAt method ////
}
The problem is in PartialFunction, second argument to aplyOrElse is also called default
with type A1 => B1
. Here is it in the Scala compiler Typer phase, so you can make a ticket i guess