We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 649a6ac commit 7508d41Copy full SHA for 7508d41
tests/neg/i11899.scala
@@ -0,0 +1,10 @@
1
+import java.util.function.Function
2
+
3
+class Future[T](val initial: T) {
4
+ def map[V](v: V): Unit = println(v)
5
+ def map[U](fn: Function[T, U]): Unit = println(fn(initial))
6
+}
7
8
+val f = new Future(42)
9
+val fn = (i: Int) => i.toString
10
+def test = f.map(fn) // error
tests/run/i11938.scala
@@ -8,7 +8,8 @@ class Future[T](val initial: T) {
object Test {
val f = new Future(42)
11
- val fn = (i: Int) => i.toString
+ def fn(i: Int) = i.toString
12
def main(args: Array[String]): Unit =
13
f.map((i: Int) => i.toString)
14
+ f.map(fn)
15
}
0 commit comments