split SuperGenTest.enclosed

This commit is contained in:
Stepan Koltsov
2012-02-09 23:40:43 +04:00
parent 8e6e8e938c
commit 9b6e051dc1
3 changed files with 31 additions and 14 deletions
@@ -0,0 +1,31 @@
trait BK {
fun x() : Int = 50
}
trait K : BK {
override fun x() : Int = super.x() * 2
}
open class M() {
open fun x() : Int = 10
}
open class N() : M(), K {
override fun x() : Int = 20
open class C() : K {
fun test1() = x()
fun test2() = super<M>@N.x()
fun test3() = super<K>@N.x()
fun test4() = super<K>.x()
}
}
fun box(): String {
if (N().C().test1() != 100) return "test1 fail";
if (N().C().test2() != 10) return "test2 fail";
if (N().C().test3() != 100) return "test3 fail";
if (N().C().test4() != 100) return "test4 fail";
return "OK";
}