Files
kotlin-fork/compiler/testData/codegen/box/jvmField/topLevelFieldReference.kt
T
Ivan Kylchik c7435ba760 Replace all occurrences of WITH_RUNTIME with WITH_STDLIB
We are going to deprecate `WITH_RUNTIME` directive. The main reason
behind this change is that `WITH_STDLIB` directive better describes
its meaning, specifically it will add kotlin stdlib to test's classpath.
2021-11-17 15:26:38 +03:00

28 lines
592 B
Kotlin
Vendored

// TARGET_BACKEND: JVM
// WITH_STDLIB
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")
}