PSI2IR KT-47939 callable references to fun interface constructors
This commit is contained in:
committed by
TeamCityServer
parent
1fd0dec5e7
commit
27a144f86f
@@ -0,0 +1,36 @@
|
||||
// !LANGUAGE: +AllowKotlinFunInterfaceConstructorReference
|
||||
// WITH_REFLECT
|
||||
import kotlin.reflect.*
|
||||
|
||||
fun interface KRunnable {
|
||||
fun run()
|
||||
}
|
||||
|
||||
typealias KR = KRunnable
|
||||
|
||||
fun interface KSupplier<T> {
|
||||
fun get(): T
|
||||
}
|
||||
|
||||
typealias KSS = KSupplier<String>
|
||||
|
||||
fun interface KConsumer<T> {
|
||||
fun accept(x: T)
|
||||
}
|
||||
|
||||
typealias KCS = KConsumer<String>
|
||||
|
||||
fun test1() = ::KRunnable
|
||||
|
||||
fun test1a() = ::KR
|
||||
|
||||
fun test1b(): KFunction<Runnable> = ::Runnable
|
||||
|
||||
fun test2(): (() -> String) -> KSupplier<String> = ::KSupplier
|
||||
|
||||
fun test2a(): (() -> String) -> KSupplier<String> = ::KSS
|
||||
|
||||
fun test3(): ((String) -> Unit) -> KConsumer<String> = ::KConsumer
|
||||
|
||||
fun test3a(): ((String) -> Unit) -> KConsumer<String> = ::KCS
|
||||
|
||||
Reference in New Issue
Block a user