Update compiler tests to use KProperty instead of PropertyMetadata

This commit is contained in:
Alexander Udalov
2015-10-13 14:02:29 +03:00
parent a6846b3967
commit 51bf68ce27
68 changed files with 265 additions and 139 deletions
@@ -1,3 +1,5 @@
import kotlin.reflect.KProperty
val four: Int by NumberDecrypter
class A {
@@ -5,7 +7,7 @@ class A {
}
object NumberDecrypter {
fun getValue(instance: Any?, data: PropertyMetadata) = when (data.name) {
fun getValue(instance: Any?, data: KProperty<*>) = when (data.name) {
"four" -> 4
"two" -> 2
else -> throw AssertionError()
@@ -1,13 +1,15 @@
import kotlin.reflect.KProperty
var result: String by Delegate
object Delegate {
var value = "lol"
fun getValue(instance: Any?, data: PropertyMetadata): String {
fun getValue(instance: Any?, data: KProperty<*>): String {
return value
}
fun setValue(instance: Any?, data: PropertyMetadata, newValue: String) {
fun setValue(instance: Any?, data: KProperty<*>, newValue: String) {
value = newValue
}
}
@@ -1,6 +1,7 @@
//For KT-6020
import kotlin.reflect.KProperty1
import kotlin.reflect.KMutableProperty1
import kotlin.reflect.KProperty
class Value<T>(var value: T = null as T, var text: String? = null)
@@ -9,7 +10,7 @@ val <T> Value<T>.additionalText by DVal(Value<T>::text) //works
val <T> Value<T>.additionalValue by DVal(Value<T>::value) //not work
class DVal<T, R, P: KProperty1<T, R>>(val kmember: P) {
fun getValue(t: T, p: PropertyMetadata): R {
fun getValue(t: T, p: KProperty<*>): R {
return kmember.get(t)
}
}