PSI2IR KT-47939 callable references to fun interface constructors

This commit is contained in:
Dmitry Petrov
2021-11-29 17:01:28 +03:00
committed by TeamCityServer
parent 1fd0dec5e7
commit 27a144f86f
9 changed files with 376 additions and 23 deletions
@@ -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