Closed
Description
Compiler version
3.1.1
Minimized code
//> using scala "3.1.1"
class Dummy
object Dummy:
val empty = new Dummy
sealed trait Node:
def as[T](using d: Dummy = Dummy.empty): Either[String, T] = ???
object Sample extends App {
val node: Node = ???
val x: Either[Int, Any] = node.as[Any]
}
Output
Compiling project (Scala 3.1.1, JVM)
[error] ./Sample.scala:13:41: no implicit argument of type Dummy was found for parameter d of method as in trait Node
[error] val x: Either[Int, Any] = node.as[Any]
[error] ^
Error compiling project (Scala 3.1.1, JVM)
Expectation
The error message is misleading, something like: Found Either[String, Any], required Either[Int, Any]
will be more adequate.