Closed
Description
Compiler version
3.3.1, 3.4.1
Minimized code
trait F[A]
given F[Int] = new F {}
def f[A: F] = { (x: A) => x }
println(f[Int](1))
Output
|f[Int](1)
| ^
| Found: (1 : Int)
| Required: F[Int]
|
| longer explanation available when compiling with `-explain`
Expectation
Scala 3 Book suggests that context bound de-sugaring mirrors the following code:
def f[A](using F[A]) = { (x: A) => x }
Yet, the latter doesn't lead to a compile error in f[Int](1)
.