Update compiler tests to use KProperty instead of PropertyMetadata
This commit is contained in:
@@ -1,14 +1,16 @@
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
class MyClass() {
|
||||
public var x: Int by Delegate()
|
||||
private set
|
||||
}
|
||||
|
||||
class Delegate {
|
||||
fun getValue(t: Any?, p: PropertyMetadata): Int {
|
||||
fun getValue(t: Any?, p: KProperty<*>): Int {
|
||||
return 1
|
||||
}
|
||||
|
||||
fun setValue(t: Any?, p: PropertyMetadata, i: Int) {}
|
||||
fun setValue(t: Any?, p: KProperty<*>, i: Int) {}
|
||||
}
|
||||
|
||||
// TESTED_OBJECT_KIND: function
|
||||
|
||||
+4
-2
@@ -1,9 +1,11 @@
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
class TestDelegate() {
|
||||
fun getValue(thisRef: Any?, desc: PropertyMetadata): Int {
|
||||
fun getValue(thisRef: Any?, desc: KProperty<*>): Int {
|
||||
return 10
|
||||
}
|
||||
|
||||
public open fun setValue(thisRef: Any?, desc: PropertyMetadata, svalue : Int) {
|
||||
public open fun setValue(thisRef: Any?, desc: KProperty<*>, svalue : Int) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
+3
-1
@@ -1,5 +1,7 @@
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
class TestDelegate() {
|
||||
fun getValue(thisRef: Any?, desc: PropertyMetadata): Int {
|
||||
fun getValue(thisRef: Any?, desc: KProperty<*>): Int {
|
||||
return 10
|
||||
}
|
||||
}
|
||||
|
||||
+5
-3
@@ -1,14 +1,16 @@
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
public open class TestDelegate<T: Any>(private val initializer: () -> T) {
|
||||
private var value: T? = null
|
||||
|
||||
public open fun getValue(thisRef: Any?, desc: PropertyMetadata): T {
|
||||
public open fun getValue(thisRef: Any?, desc: KProperty<*>): T {
|
||||
if (value == null) {
|
||||
value = initializer()
|
||||
}
|
||||
return value!!
|
||||
}
|
||||
|
||||
public open fun setValue(thisRef: Any?, desc: PropertyMetadata, svalue : T) {
|
||||
public open fun setValue(thisRef: Any?, desc: KProperty<*>, svalue : T) {
|
||||
value = svalue
|
||||
}
|
||||
}
|
||||
@@ -28,4 +30,4 @@ class Test {
|
||||
|
||||
// TESTED_OBJECT_KIND: property
|
||||
// TESTED_OBJECTS: Test, prop$delegate
|
||||
// FLAGS: ACC_STATIC, ACC_PRIVATE, ACC_FINAL
|
||||
// FLAGS: ACC_STATIC, ACC_PRIVATE, ACC_FINAL
|
||||
|
||||
+4
-2
@@ -1,14 +1,16 @@
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
public open class TestDelegate<T: Any>(private val initializer: () -> T) {
|
||||
private var value: T? = null
|
||||
|
||||
public open fun getValue(thisRef: Any?, desc: PropertyMetadata): T {
|
||||
public open fun getValue(thisRef: Any?, desc: KProperty<*>): T {
|
||||
if (value == null) {
|
||||
value = initializer()
|
||||
}
|
||||
return value!!
|
||||
}
|
||||
|
||||
public open fun setValue(thisRef: Any?, desc: PropertyMetadata, svalue : T) {
|
||||
public open fun setValue(thisRef: Any?, desc: KProperty<*>, svalue : T) {
|
||||
value = svalue
|
||||
}
|
||||
}
|
||||
|
||||
+5
-3
@@ -1,9 +1,11 @@
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
class TestDelegate() {
|
||||
fun getValue(thisRef: Any?, desc: PropertyMetadata): Int {
|
||||
fun getValue(thisRef: Any?, desc: KProperty<*>): Int {
|
||||
return 10
|
||||
}
|
||||
|
||||
public open fun setValue(thisRef: Any?, desc: PropertyMetadata, svalue : Int) {
|
||||
public open fun setValue(thisRef: Any?, desc: KProperty<*>, svalue : Int) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -28,4 +30,4 @@ interface Test {
|
||||
|
||||
// TESTED_OBJECT_KIND: property
|
||||
// TESTED_OBJECTS: Test, prop$delegate
|
||||
// ABSENT: TRUE
|
||||
// ABSENT: TRUE
|
||||
|
||||
+4
-2
@@ -1,5 +1,7 @@
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
class TestDelegate() {
|
||||
fun getValue(thisRef: Any?, desc: PropertyMetadata): Int {
|
||||
fun getValue(thisRef: Any?, desc: KProperty<*>): Int {
|
||||
return 10
|
||||
}
|
||||
}
|
||||
@@ -24,4 +26,4 @@ interface Test {
|
||||
|
||||
// TESTED_OBJECT_KIND: property
|
||||
// TESTED_OBJECTS: Test, prop$delegate
|
||||
// ABSENT: TRUE
|
||||
// ABSENT: TRUE
|
||||
|
||||
Reference in New Issue
Block a user