[AA LC] Add test for modifiers of delegate fields

This commit is contained in:
Dmitriy Novozhilov
2022-10-03 17:51:24 +03:00
committed by Space Team
parent 95f5848e6c
commit 34af013913
10 changed files with 221 additions and 0 deletions
@@ -0,0 +1,28 @@
// Container
import kotlin.reflect.KProperty
class Container {
companion object {
fun <R> delegate(): Delegate<R> = null!!
}
interface Delegate<R> {
operator fun getValue(thisRef: Any?, property: KProperty<*>): R = null!!
operator fun setValue(thisRef: Any?, property: KProperty<*>, value: R) {
}
}
abstract class Base {
val a: String by delegate()
open val b: String by delegate()
open val c: String = ""
abstract val d: String
}
class Derived : Base() {
override val b: String by delegate()
override val c: String by delegate()
override val d: String by delegate()
}
}