Type-check reference to property with invisible setter to KProperty
#KT-12337 Fixed
This commit is contained in:
+18
@@ -0,0 +1,18 @@
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user