Files
kotlin-fork/compiler/testData/codegen/box/super/enclosedVar.kt
T
Ting-Yuan Huang 1c3b895fc0 Generate accessors for super calls if necessary
Current implementation of calls with super qualifier relies on
invokespecial, which has some more constraints than regular virtual
invocations. When those constraints aren't met, accessors are needed.
2019-05-10 08:57:37 +02:00

23 lines
398 B
Kotlin
Vendored

open class M() {
open var y = 500
}
open class N() : M() {
override var y = 200
open inner class C() {
fun test5() = y
fun test6() : Int {
super<M>@N.y += 200
return super<M>@N.y
}
}
}
fun box(): String {
if (N().C().test5() != 200) return "test5 fail";
if (N().C().test6() != 700) return "test6 fail";
return "OK";
}