Added link test, checking correct object field layout.
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
package a
|
||||
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
open class A {
|
||||
open val x = 42
|
||||
}
|
||||
|
||||
class Delegate {
|
||||
val f = 117
|
||||
operator fun getValue(receiver: Any?, p: KProperty<*>): Int {
|
||||
println(p.name)
|
||||
return f
|
||||
}
|
||||
}
|
||||
|
||||
open class B: A() {
|
||||
override val x: Int by Delegate()
|
||||
|
||||
fun bar() {
|
||||
println(super<A>.x)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import a.*
|
||||
|
||||
open class C: B() {
|
||||
override val x: Int = 156
|
||||
|
||||
fun foo() {
|
||||
println(x)
|
||||
|
||||
println(super<B>.x)
|
||||
bar()
|
||||
}
|
||||
}
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
val c = C()
|
||||
c.foo()
|
||||
}
|
||||
Reference in New Issue
Block a user