Closed
Description
I would not expect an ambiguity in this case.
scala> object O {
| def foo(f: String => String) = 1
| def foo(f: java.util.function.Function[String, String]) = 2
| }
defined object O
scala> def f[A]: A => A = null
f: [A]=> A => A
scala> O.foo(f)
<console>:14: error: overloaded method value foo with alternatives:
(f: java.util.function.Function[String,String])Int <and>
(f: String => String)Int
cannot be applied to (Nothing => Nothing)
O.foo(f)
^
given that the does not typecheck:
scala> object O {
| def foo(f: java.util.function.Function[String, String]) = 2
| }
defined object O
scala> def f[A]: A => A = null
f: [A]=> A => A
scala> O.foo(f)
<console>:14: error: type mismatch;
found : String => String
required: java.util.function.Function[String,String]
O.foo(f)
^