[AA LC] Add test for modifiers of delegate fields
This commit is contained in:
committed by
Space Team
parent
95f5848e6c
commit
34af013913
@@ -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()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user