Added one more test for initialization order.
This commit is contained in:
@@ -28,6 +28,11 @@ public final class ClassInheritanceTest extends AbstractClassTest {
|
||||
public void initializationOrder() throws Exception {
|
||||
testFooBoxIsTrue("initializationOrder.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void complexInitializationOrder() throws Exception {
|
||||
testFooBoxIsTrue("complexInitializationOrder.kt");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
namespace foo
|
||||
|
||||
open class A() {
|
||||
|
||||
var order = ""
|
||||
{
|
||||
order = order + "A"
|
||||
}
|
||||
}
|
||||
|
||||
open class B() : A() {
|
||||
{
|
||||
order = order + "B"
|
||||
}
|
||||
}
|
||||
|
||||
class C() : B() {
|
||||
{
|
||||
order = order + "C"
|
||||
}
|
||||
}
|
||||
|
||||
class D() : B() {
|
||||
{
|
||||
order = order + "D"
|
||||
}
|
||||
}
|
||||
|
||||
class E() : A() {
|
||||
{
|
||||
order = order + "E"
|
||||
}
|
||||
}
|
||||
|
||||
fun box() : Boolean {
|
||||
return (C().order == "ABC") && (D().order == "ABD") && (E().order == "AE")
|
||||
}
|
||||
Reference in New Issue
Block a user