Convert lambda to reference: support generic function call
#KT-14578 Fixed #KT-14395 Fixed
This commit is contained in:
committed by
Roman Golyshev
parent
2137a4b1e5
commit
7ea1700b78
@@ -0,0 +1,6 @@
|
||||
// WITH_RUNTIME
|
||||
fun <T> foo(i: Int): T? = null
|
||||
|
||||
fun test(list: List<Int>) {
|
||||
list.mapNotNull <caret>{ foo<String>(it) }
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
// WITH_RUNTIME
|
||||
fun <T> foo(i: Int): T? = null
|
||||
|
||||
fun test(list: List<Int>) {
|
||||
list.mapNotNull<Int, String>(::foo)
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// WITH_RUNTIME
|
||||
interface CD
|
||||
|
||||
fun <D : CD> D.foo(): D? = null
|
||||
|
||||
fun test(x: List<CD>) {
|
||||
x.mapNotNull <caret>{ it.foo() }
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// WITH_RUNTIME
|
||||
interface CD
|
||||
|
||||
fun <D : CD> D.foo(): D? = null
|
||||
|
||||
fun test(x: List<CD>) {
|
||||
x.mapNotNull(CD::foo)
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
// WITH_RUNTIME
|
||||
fun test() {
|
||||
listOf(listOf(1)).filter <caret>{ it.isNotEmpty() }
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
// WITH_RUNTIME
|
||||
fun test() {
|
||||
listOf(listOf(1)).filter(List<Int>::isNotEmpty)
|
||||
}
|
||||
Reference in New Issue
Block a user