Files
kotlin/compiler/testData/codegen/box/callableReference/property/privateSetterInsideClass.kt
2016-06-19 12:45:22 +03:00

19 lines
370 B
Kotlin
Vendored

import kotlin.reflect.KMutableProperty
class Bar(name: String) {
var foo: String = name
private set
fun test() {
val p = Bar::foo
if (p !is KMutableProperty<*>) throw AssertionError("Fail: p is not a KMutableProperty")
p.set(this, "OK")
}
}
fun box(): String {
val bar = Bar("Fail")
bar.test()
return bar.foo
}