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
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)
^