Files
kotlin-fork/compiler/testData/codegen/box/reflection/annotations/localClassParameterAnnotation.kt
T
2021-11-15 19:53:49 +03:00

31 lines
791 B
Kotlin
Vendored

// IGNORE_BACKEND: JS_IR
// IGNORE_BACKEND: JS_IR_ES6
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS, NATIVE, WASM
// WITH_REFLECT
import kotlin.reflect.full.valueParameters
@Retention(AnnotationRetention.RUNTIME)
annotation class Simple(val value: String)
fun local(): Any {
class A(@Simple("OK") val z: String)
return A("OK")
}
fun localCaptured(): Any {
val z = 1
class A(@Simple("K") val z: String) {
val x = z
}
return A("K")
}
fun box(): String {
return (local()::class.constructors.single().valueParameters.single().annotations.single() as Simple).value
//KT-25573
//return (localCaptured()::class.constructors.single().valueParameters.single().annotations.single() as Simple).value
}