Files
kotlin/compiler/testData/codegen/box/classes/diamondInheritance.kt
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

25 lines
441 B
Kotlin

// Changed when traits were introduced. May not make sense any more
open class Base() {
public var v : Int = 0
}
open class Left() : Base() {}
trait Right : Base {}
class D() : Left(), Right
fun vl(l : Left) : Int = l.v
fun vr(r : Right) : Int = r.v
fun box() : String {
val d = D()
d.v = 42
if (d.v != 42) return "Fail #1"
if (vl(d) != 42) return "Fail #2"
if (vr(d) != 42) return "Fail #3"
return "OK"
}