Files
kotlin/compiler/testData/codegen/box/innerNested/superConstructorCall/deepInnerHierarchy.kt
pyos 82ccf81da8 Fix this remapping in inner class constructors
Inner class constructors should use the argument instead of reading
outer `this` from a field because if such an access happens before a
delegating constructor call, e.g. when evaluating an argument, a JVM
bytecode validation error will be thrown. (The only operation on `this`
allowed before a delegating constructor call is SETFIELD, and only if
the field in question is declared in the same class.)
2019-03-19 09:20:41 +01:00

14 lines
326 B
Kotlin
Vendored

open class A(val s: String) {
open inner class B(s: String): A(s)
open inner class C(s: String, additional: Double): B(s)
open inner class D(other: Int, another: Long, s: String) : C(s, another.toDouble())
open inner class E : D(0, 42L, "OK")
inner class F : E()
}
fun box(): String = A("Fail").F().s