Load Java static members from parents

This commit is contained in:
Zalim Bashorov
2015-10-05 19:16:03 +03:00
parent d90585624f
commit ae2831338b
40 changed files with 843 additions and 2 deletions

View File

@@ -0,0 +1,4 @@
class Child extends Parent {
public static int b = 3;
public static int c = 4;
}

View File

@@ -0,0 +1,4 @@
class Parent {
public static int a = 1;
public static int b = 2;
}

View File

@@ -0,0 +1,9 @@
fun box(): String {
if (Parent.a != 1) return "expected Parent.a == 1"
if (Parent.b != 2) return "expected Parent.b == 2"
if (Child.a != 1) return "expected Child.a == 1"
if (Child.b != 3) return "expected Child.b == 3"
if (Child.c != 4) return "expected Child.c == 4"
return "OK"
}

View File

@@ -0,0 +1,8 @@
class Child extends Parent {
public static String bar() {
return "Child.bar";
}
public static String baz() {
return "Child.baz";
}
}

View File

@@ -0,0 +1,8 @@
class Parent {
public static String foo() {
return "Parent.foo";
}
public static String baz() {
return "Parent.baz";
}
}

View File

@@ -0,0 +1,9 @@
fun box(): String {
if (Parent.foo() != "Parent.foo") return "expected: Parent.foo"
if (Parent.baz() != "Parent.baz") return "expected: Parent.baz"
if (Child.foo() != "Parent.foo") return "expected: Child.foo() != Parent.foo"
if (Child.baz() != "Child.baz") return "expected: Child.baz"
if (Child.bar() != "Child.bar") return "expected: Child.bar"
return "OK"
}

View File

@@ -0,0 +1,9 @@
class Child extends Parent {
public static String a = "2";
public static String foo() {
return "Child.foo()";
}
public static String foo(int i) {
return "Child.foo(int)";
}
}

View File

@@ -0,0 +1,6 @@
class Parent {
private static int a = 1;
private static String foo() {
return "Parent.foo";
}
}

View File

@@ -0,0 +1,7 @@
fun box(): String {
if (Child.a != "2") return "Fail #1"
if (Child.foo() != "Child.foo()") return "Fail #2"
if (Child.foo(1) != "Child.foo(int)") return "Fail #3"
return "OK"
}