Remove PropertyMetadata from project and bytecode, migrate code to KProperty

This commit is contained in:
Alexander Udalov
2015-11-20 16:37:47 +03:00
parent fb61dc7e81
commit 7b3b157707
22 changed files with 99 additions and 74 deletions
@@ -15,12 +15,14 @@ class BigTest {
// FILE: second.kt
package some
import kotlin.reflect.KProperty
class DelegateImpl<T> {
val value: T = null!!
}
public fun <T> DelegateImpl<T>.getValue(thisRef: Any?, property: PropertyMetadata): T = value
public fun <T> DelegateImpl<T>.setValue(thisRef: Any, propertyMetadata: PropertyMetadata, t: T) {}
public fun <T> DelegateImpl<T>.getValue(thisRef: Any?, property: KProperty<*>): T = value
public fun <T> DelegateImpl<T>.setValue(thisRef: Any, property: KProperty<*>, t: T) {}
@@ -38,5 +40,3 @@ import some.setValue
class BigTest {
var a by <caret>DelegateImpl<Int>()
}
@@ -15,11 +15,13 @@ class BigTest {
// FILE: second.kt
package some
import kotlin.reflect.KProperty
class DelegateImpl<T> {
val value: T = null!!
}
public fun <T> DelegateImpl<T>.getValue(thisRef: Any?, property: PropertyMetadata): T = value
public fun <T> DelegateImpl<T>.getValue(thisRef: Any?, property: KProperty<*>): T = value
@@ -34,4 +36,4 @@ import some.getValue
class BigTest {
val a by <caret>DelegateImpl<Int>()
}
}
@@ -15,12 +15,14 @@ class BigTest {
// FILE: second.kt
package some
import kotlin.reflect.KProperty
class DelegateImpl<T> {
val value: T = null!!
}
operator fun <T> DelegateImpl<T>.getValue(thisRef: Any?, property: PropertyMetadata): T = value
operator fun <T> DelegateImpl<T>.setValue(thisRef: Any, propertyMetadata: PropertyMetadata, t: T) {}
operator fun <T> DelegateImpl<T>.getValue(thisRef: Any?, property: KProperty<*>): T = value
operator fun <T> DelegateImpl<T>.setValue(thisRef: Any, property: KProperty<*>, t: T) {}
@@ -37,5 +39,3 @@ import some.setValue
class BigTest {
var a by <caret>DelegateImpl<Int>()
}
@@ -1,7 +1,9 @@
// "Rename to 'getValue'" "true"
import kotlin.reflect.KProperty
class CustomDelegate
operator fun CustomDelegate.get(thisRef: Any?, prop: PropertyMetadata): String = ""
operator fun CustomDelegate.get(thisRef: Any?, prop: KProperty<*>): String = ""
class Example {
val a: String <caret>by CustomDelegate()
@@ -1,7 +1,9 @@
// "Rename to 'getValue'" "true"
import kotlin.reflect.KProperty
class CustomDelegate
operator fun CustomDelegate.getValue(thisRef: Any?, prop: PropertyMetadata): String = ""
operator fun CustomDelegate.getValue(thisRef: Any?, prop: KProperty<*>): String = ""
class Example {
val a: String by CustomDelegate()
@@ -1,9 +1,11 @@
// "Rename to 'setValue'" "true"
// ERROR: 'get' method convention on type 'CustomDelegate' is deprecated. Rename to 'getValue'
import kotlin.reflect.KProperty
class CustomDelegate {
operator fun get(thisRef: Any?, prop: PropertyMetadata): String = ""
operator fun set(thisRef: Any?, prop: PropertyMetadata, value: String) {}
operator fun get(thisRef: Any?, prop: KProperty<*>): String = ""
operator fun set(thisRef: Any?, prop: KProperty<*>, value: String) {}
}
class Example {
@@ -1,9 +1,11 @@
// "Rename to 'setValue'" "true"
// ERROR: 'get' method convention on type 'CustomDelegate' is deprecated. Rename to 'getValue'
import kotlin.reflect.KProperty
class CustomDelegate {
operator fun get(thisRef: Any?, prop: PropertyMetadata): String = ""
operator fun setValue(thisRef: Any?, prop: PropertyMetadata, value: String) {}
operator fun get(thisRef: Any?, prop: KProperty<*>): String = ""
operator fun setValue(thisRef: Any?, prop: KProperty<*>, value: String) {}
}
class Example {