JVM_IR KT-47939 use FunInterfaceConstructorReference as base class
This commit is contained in:
committed by
TeamCityServer
parent
0ccd7a7e0c
commit
93713a9ad4
+24
@@ -0,0 +1,24 @@
|
||||
// !LANGUAGE: +KotlinFunInterfaceConstructorReference
|
||||
|
||||
// DONT_TARGET_EXACT_BACKEND: JVM
|
||||
// ^ old JVM BE generates bogus code
|
||||
|
||||
// IGNORE_BACKEND: JS
|
||||
// ^ Failed: kr is class Function1
|
||||
|
||||
// WITH_REFLECT
|
||||
|
||||
import kotlin.reflect.KFunction
|
||||
|
||||
fun interface KRunnable {
|
||||
fun run()
|
||||
}
|
||||
|
||||
val kr = ::KRunnable // : KFunction1<() -> Unit, KRunnable>
|
||||
|
||||
fun box(): String {
|
||||
return if (kr is KFunction<*>)
|
||||
"OK"
|
||||
else
|
||||
"Failed: kr is ${kr::class}"
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
// !LANGUAGE: +KotlinFunInterfaceConstructorReference
|
||||
|
||||
// IGNORE_BACKEND: JVM
|
||||
// ^ unsupported in old JVM BE
|
||||
|
||||
fun interface KRunnable {
|
||||
fun run()
|
||||
}
|
||||
|
||||
val kr = ::KRunnable // : KFunction1<() -> Unit, KRunnable>
|
||||
|
||||
fun box(): String {
|
||||
var test = "Failed"
|
||||
kr { test = "OK" }.run()
|
||||
return test
|
||||
}
|
||||
Reference in New Issue
Block a user