KT-286 Check supertype lists (in progress)
Tests involving multiple inheritance fixed
This commit is contained in:
@@ -1,11 +1,13 @@
|
||||
class Base() {
|
||||
// Changed when traits were introduced. May not make sense any more
|
||||
|
||||
open class Base() {
|
||||
public var v : Int = 0
|
||||
}
|
||||
|
||||
class Left() : Base() {}
|
||||
class Right() : Base() {}
|
||||
open class Left() : Base() {}
|
||||
trait class Right : Base {}
|
||||
|
||||
class D() : Left(), Right()
|
||||
class D() : Left(), Right
|
||||
|
||||
fun vl(l : Left) : Int = l.v
|
||||
fun vr(r : Right) : Int = r.v
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
class Base() {
|
||||
open class Base() {
|
||||
fun n(n : Int) : Int = n + 1
|
||||
}
|
||||
|
||||
class Abstract {}
|
||||
trait class Abstract {}
|
||||
|
||||
class Derived1() : Base(), Abstract {}
|
||||
class Derived2() : Abstract, Base() {}
|
||||
|
||||
@@ -1,9 +1,17 @@
|
||||
class X(val x : Int) {}
|
||||
class Y(val y : Int) {}
|
||||
// Changed when traits were introduced. May not make sense any more
|
||||
|
||||
class Point(x : Int, y : Int) : X(x) , Y(y) {}
|
||||
open class X(val x : Int) {}
|
||||
trait class Y {
|
||||
abstract val y : Int
|
||||
}
|
||||
|
||||
class Abstract {}
|
||||
class YImpl(val y : Int) : Y {}
|
||||
|
||||
class Point(x : Int, yy : Int) : X(x) , Y {
|
||||
override val y : Int = yy
|
||||
}
|
||||
|
||||
trait class Abstract {}
|
||||
|
||||
class P1(x : Int, yy : Y) : Abstract, X(x), Y by yy {}
|
||||
class P2(x : Int, yy : Y) : X(x), Abstract, Y by yy {}
|
||||
@@ -12,12 +20,12 @@ class P4(x : Int, yy : Y) : Y by yy, Abstract, X(x) {}
|
||||
|
||||
fun box() : String {
|
||||
if (X(239).x != 239) return "FAIL #1"
|
||||
if (Y(239).y != 239) return "FAIL #2"
|
||||
if (YImpl(239).y != 239) return "FAIL #2"
|
||||
|
||||
val p = Point(240, -1)
|
||||
if (p.x + p.y != 239) return "FAIL #3"
|
||||
|
||||
val y = Y(-1)
|
||||
val y = YImpl(-1)
|
||||
val p1 = P1(240, y)
|
||||
if (p1.x + p1.y != 239) return "FAIL #4"
|
||||
val p2 = P2(240, y)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class Outer() {
|
||||
class InnerBase() {
|
||||
open class InnerBase() {
|
||||
}
|
||||
|
||||
class InnerDerived(): InnerBase() {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class Foo {
|
||||
open class Foo {
|
||||
fun xyzzy(): String = "xyzzy"
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class Base() {
|
||||
open class Base() {
|
||||
public val plain = 239
|
||||
public val read : Int
|
||||
get() = 239
|
||||
@@ -10,7 +10,7 @@ class Base() {
|
||||
}
|
||||
}
|
||||
|
||||
class Abstract {}
|
||||
trait class Abstract {}
|
||||
|
||||
class Derived1() : Base(), Abstract {}
|
||||
class Derived2() : Abstract, Base() {}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
class Outer() {
|
||||
public val s = "xyzzy"
|
||||
|
||||
class InnerBase(public val name: String) {
|
||||
open class InnerBase(public val name: String) {
|
||||
}
|
||||
|
||||
class InnerDerived(): InnerBase(s) {
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
class Left() {}
|
||||
class Right() {
|
||||
// Changed when traits were introduced. May not make sense any more
|
||||
|
||||
trait class Left {}
|
||||
open class Right() {
|
||||
virtual fun f() = 42
|
||||
}
|
||||
|
||||
class D() : Left(), Right() {
|
||||
class D() : Left, Right() {
|
||||
override fun f() = 239
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user