Skip to content

Commit 7508d41

Browse files
committed
More tests
1 parent 649a6ac commit 7508d41

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

tests/neg/i11899.scala

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ class Future[T](val initial: T) {
88

99
object Test {
1010
val f = new Future(42)
11-
val fn = (i: Int) => i.toString
11+
def fn(i: Int) = i.toString
1212
def main(args: Array[String]): Unit =
1313
f.map((i: Int) => i.toString)
14+
f.map(fn)
1415
}

0 commit comments

Comments
 (0)