Files
kotlin-fork/compiler/testData/codegen/box/classes/delegation3.kt
T
Alexander Udalov 41a416da60 Move blackBoxFile() testData to box/ directory
Delete all test methods (and empty test classes), since they'll be
auto-generated
2013-01-28 18:20:17 +04:00

36 lines
681 B
Kotlin

trait One {
public open fun foo() : Int
public open fun faz() : Int = 10
}
trait Two {
public open fun foo() : Int
public open fun quux() : Int = 100
}
class OneImpl : One {
public override fun foo() = 1
}
class TwoImpl : Two {
public override fun foo() = 2
}
class Test2(a : One, b : Two) : Two by b, One by a {
public override fun foo() = 0
}
fun box() : String {
var t2 = Test2(OneImpl(), TwoImpl())
if (t2.foo() != 0)
return "Fail #1"
if (t2.faz() != 10)
return "Fail #2"
if (t2.quux() != 100)
return "Fail #3"
if (t2 !is One)
return "Fail #4"
if (t2 !is Two)
return "Fail #5"
return "OK"
}