Tests for objects + delegation specifier resolution + override bindings for objects

This commit is contained in:
Andrey Breslav
2011-06-03 15:09:47 +04:00
parent e3f9978e4d
commit 36470388c4
7 changed files with 218 additions and 86 deletions
+59
View File
@@ -0,0 +1,59 @@
namespace toplevelObjectDeclarations {
class Foo(y : Int) {
virtual fun foo() : Int = 1
}
class T : <error>Foo</error> {}
object A : <error>Foo</error> {
val x : Int = 2
fun test() {
return x + foo()
}
}
object B : <error>A</error> {}
val x = A.foo()
val y = object : Foo(x) {
{
x + 12
}
override fun foo() : Int = 1
}
val z = y.foo()
}
namespace nestedObejcts {
object A {
val b = B
val d = A.B.A
object B {
val a = A
val e = B.A
object A {
val a = A
val b = B
val x = nestedObejcts.A.B.A
val y = this<error>@A</error>
}
}
}
object B {
val b = B
val c = A.B
}
val a = A
val b = B
val c = A.B
val d = A.B.A
val e = B.<error>A</error>.B
}
+28
View File
@@ -0,0 +1,28 @@
~ns~namespace nestedObjects {
object ~A~A {
val b = `A.B`B
val d = `A`A.`A.B`B.`A.B.A`A
object ~A.B~B {
val a = `A.B.A`A
val e = `A.B`B.`A.B.A`A
object ~A.B.A~A {
val a = `A.B.A`A
val b = `A.B`B
val x = `ns`nestedObjects.`A`A.`A.B`B.`A.B.A`A
}
}
}
object ~B~B {
val b = `B`B
val c = `A`A.`A.B`B
}
val a = `A`A
val b = `B`B
val c = `A`A.`A.B`B
val d = A.B.`A.B.A`A
val e = B.`!`A.B
}
+28
View File
@@ -0,0 +1,28 @@
namespace toplevelObjectDeclarations {
class Foo(y : Int) {
~foo()~virtual fun foo() : Int = 1
}
object ~A~A : Foo(0) {
~x~val x : Int = 2
fun test() {
return `x`x + `foo()`foo()
}
}
object B : `!`A {}
~ns.x~val x = `A`A.`foo()`foo()
~y~val y = object : Foo(`ns.x`x) {
{
`ns.x`x + 12
}
~y.foo()~override fun foo() : Int = 1
}
val z = `y`y.`y.foo()`foo()
}