Files
kotlin-fork/compiler/testData/codegen/box/jvmField/topLevelFieldReference.kt
T
Mikhail Glukhikh 8c21f04bf4 FIR2IR: determine type parameters before value parameters
Type parameters can be referred from value parameters,
so we should determine them earlier to be able to set their indexes
2020-02-20 18:34:51 +03:00

28 lines
593 B
Kotlin
Vendored

// TARGET_BACKEND: JVM
// WITH_RUNTIME
package zzz
import java.lang.reflect.Field
import kotlin.test.assertEquals
import kotlin.reflect.KProperty0
@JvmField public val publicField = "1";
@JvmField internal val internalField = "2";
fun testAccessors() {
val kProperty: KProperty0<String> = ::publicField
checkAccessor(kProperty, "1")
checkAccessor(::internalField, "2")
}
fun box(): String {
testAccessors()
return "OK"
}
public fun <T, R> checkAccessor(prop: KProperty0<T>, value: R) {
assertEquals<Any?>(prop.get(), value, "Property ${prop} has wrong value")
}