Fix for KT-7421: Unable to inherit from inner class
Fix for KT-6708: Compiler Error when extending open inner class: "java.lang.RuntimeException: Error generating primary constructor of class InnerB with kind IMPLEMENTATION" #KT-7421 Fixed #KT-6708 Fixed
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
open class A() {
|
||||
open inner class InnerA
|
||||
}
|
||||
|
||||
class B : A() {
|
||||
inner class InnerB : A.InnerA()
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
B().InnerB()
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
|
||||
open class A(val s: String) {
|
||||
|
||||
val z = s
|
||||
|
||||
fun test() = s
|
||||
|
||||
open inner class B(s: String): A(s) {
|
||||
fun testB() = z + test()
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val res = A("Fail").B("OK").testB()
|
||||
return if (res == "OKOK") "OK" else res;
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
// When inner class extends its outer, there are two instances of the outer present in the inner:
|
||||
// the enclosing one and the one in the super call.
|
||||
// Here we test that symbols are resolved to the instance created via the super call.
|
||||
// This differs from Java, so this test may change when we revisit code generation of inner classes
|
||||
|
||||
open class Outer(vararg val chars: Char) {
|
||||
open inner class Inner(val s: String): Outer(s[0], s[1]) {
|
||||
|
||||
Reference in New Issue
Block a user