Closed
Description
Compiler version
3.2.1
Minimized code
import scala.language.implicitConversions
sealed trait Ctx
given [T]: Conversion[Ctx => T, Ctx => Option[T]] = fn => fn.andThen(Option.apply)
def get[T](using fn: Ctx => Option[T]): Option[T] = ???
@main def Test = {
given foo: (Ctx => Int) = _ => 42
val works = get[Int](using summon[Ctx => Int])
val fails = get[Int]
}
Output
12 | val fails = get[Int]
| ^
| No given instance of type Ctx => Option[Int] was found for parameter fn of method get
Expectation
I agree that implicit conversion is dangerous and should be limited.
However, whenever possible, the compiler should hint the user that implicit search no longer allows for chaining conversions.
eg.
```scala
12 | val fails = get[Int]
| ^
| No given instance of type Ctx => Option[Int] was found for parameter fn of method get
| Ignored implicit Conversion[Ctx => T, Ctx => Option[T]], chaining implicit conversions in no longer allowed in Scala.
| Use explicit value as a function argument to allow for conversion:
| get[Int](using summon[Ctx => Int])