Files
kotlin/compiler/testData/codegen/box/super/innerClassLabeledSuper.kt
Alexander Udalov 8b395589be JVM IR: fix incorrect IR types in inner and enum class lowerings
In InnerClassesLowering, the type of the "outer$0" expression should be
the outer class, not the inner class. In EnumClassLowering, the type of
the enum entry is the type of its class or the type of the enum class,
but not the type of initialierExpression which is always Unit
2019-02-07 21:25:59 +01:00

39 lines
949 B
Kotlin
Vendored

interface BK {
fun foo(): String
fun bar(): String
}
interface K : BK {
override fun foo() = bar()
}
class A : K {
override fun foo() = "A.foo"
override fun bar() = "A.bar"
inner class B : K {
override fun foo() = "B.foo"
override fun bar() = "B.bar"
fun test1() = super<K>@A.foo()
fun test2() = super<K>@B.foo()
fun test3() = super<K>.foo()
fun test4() = super@A.foo()
fun test5() = super@B.foo()
fun test6() = super.foo()
}
}
fun box(): String {
val b = A().B()
if (b.test1() != "A.bar") return "test1 ${b.test1()}"
if (b.test2() != "B.bar") return "test2 ${b.test2()}"
if (b.test3() != "B.bar") return "test3 ${b.test3()}"
if (b.test4() != "A.bar") return "test4 ${b.test4()}"
if (b.test5() != "B.bar") return "test5 ${b.test5()}"
if (b.test6() != "B.bar") return "test6 ${b.test6()}"
return "OK"
}