Files
kotlin-fork/backend.native/tests/external/codegen/blackbox/closures/kt11634_4.kt
T
Ilya Matveev 1b553ebfaf backend/tests: Add blackbox tests from Kotlin JVM
Added tests from testData/codegen/box directory. There are blackbox tests
in other directories and they are to be added.
2017-01-20 14:04:04 +03:00

28 lines
528 B
Kotlin

interface A {
fun foo(): String
}
open class Base (val p: String) {
open val a = object : A {
override fun foo(): String {
return p
}
}
}
open class Derived1 (p: String): Base(p) {
override open val a = object : A {
override fun foo(): String {
return "fail"
}
}
inner class Derived2(p: String) : Base(p) {
val x = object : A by super<Base>@Derived1.a {}
}
}
fun box(): String {
return Derived1("OK").Derived2("fail").x.foo()
}