Convert reference to lambda: correct handling of static method references #KT-14982 Fixed
This commit is contained in:
@@ -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; }
|
||||
}
|
||||
+3
@@ -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
|
||||
+1
@@ -0,0 +1 @@
|
||||
val x = { x: Int, y: Int -> Utils.foo(x, y) }
|
||||
Reference in New Issue
Block a user