IR JS: support findAssociatedObject feature (KT-37418 fixed)
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
// EXPECTED_REACHABLE_NODES: 1321
|
||||
// IGNORE_BACKEND: JS_IR
|
||||
|
||||
import kotlin.reflect.*
|
||||
|
||||
@OptIn(ExperimentalAssociatedObjects::class)
|
||||
@AssociatedObjectKey
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class Associated1(val kClass: KClass<*>)
|
||||
|
||||
@Associated1(Bar::class)
|
||||
class Foo
|
||||
|
||||
object Bar
|
||||
|
||||
@OptIn(ExperimentalAssociatedObjects::class)
|
||||
fun box(): String {
|
||||
// This API is not implented in the old backend.
|
||||
if (Foo::class.findAssociatedObject<Associated1>() != null) return "fail 1"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user