Convert reference to lambda: correct handling of static method references #KT-14982 Fixed

This commit is contained in:
Mikhail Glukhikh
2016-12-02 15:37:52 +03:00
parent ea8548c55b
commit e904e56de3
13 changed files with 83 additions and 5 deletions
@@ -0,0 +1,11 @@
// WITH_RUNTIME
import Utils.Companion.foo
val list = listOf(1, 2, 3).map(<caret>::foo)
class Utils {
companion object {
fun foo(x: Int) = x
}
}
@@ -0,0 +1,11 @@
// WITH_RUNTIME
import Utils.Companion.foo
val list = listOf(1, 2, 3).map { foo(it) }
class Utils {
companion object {
fun foo(x: Int) = x
}
}
@@ -0,0 +1,7 @@
// IS_APPLICABLE: false
// WITH_RUNTIME
val list = listOf(1, 2, 3).map(<caret>Utils::foo)
object Utils {
fun foo(x: Int) = x
}
@@ -0,0 +1,3 @@
class Utils {
public static int foo(int arg) { return arg; }
}
@@ -0,0 +1,3 @@
class Utils {
public static int foo(int arg) { return arg; }
}
@@ -0,0 +1,2 @@
// WITH_RUNTIME
val list = listOf(1, 2, 3).map(<caret>Utils::foo)
@@ -0,0 +1,2 @@
// WITH_RUNTIME
val list = listOf(1, 2, 3).map { Utils.foo(it) }
@@ -0,0 +1,3 @@
class Utils {
public static int foo(int x, int y) { return x + y; }
}
@@ -0,0 +1,3 @@
class Utils {
public static int foo(int x, int y) { return x + y; }
}
@@ -0,0 +1 @@
val x = <caret>Utils::foo
@@ -0,0 +1 @@
val x = { x: Int, y: Int -> Utils.foo(x, y) }