You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After the previous commit (and also in Scala 2), the following code
doesn't compile:
def foo[V](v: V): Int = 1
def foo[U](fn: java.util.function.Function[Int, U]): Int = 2
val f: Int => Int = x => x
foo(f) // error: ambiguous overload
The problem is that we assume that the overload taking a `Function` is
applicable, even though it cannot be used since `f` is not a lambda
expression. We can fix this by inspecting the shape of the argument and
disallowing SAM conversion if the argument is known to be a non-lambda
tree.
0 commit comments