JET-84 Support generic parameter constraints for class objects

Test for classes + small fixes
This commit is contained in:
Andrey Breslav
2011-06-05 01:25:03 +04:00
parent 4204db9cb0
commit 9450e1bdf9
5 changed files with 69 additions and 6 deletions
+47
View File
@@ -0,0 +1,47 @@
namespace Jet87
open class A() {
fun foo() : Int
}
open class B() {
fun bar() : Double;
}
class C() : A(), B()
class D() {
class object : A(), B () {}
}
class Test1<T : A>
where
T : B,
<error>B</error> : T, // error
class object T : A,
class object T : B,
class object <error>B</error> : T
() {
fun test(t : T) {
T.foo()
T.bar()
t.foo()
t.bar()
}
}
fun test() {
new Test1<<error>B</error>>()
new Test1<<error>A</error>>()
new Test1<C>()
}
class Foo() {}
class Bar<T : Foo>
class Buzz<T> where T : Bar<<error>Int</error>>, T : <error>nioho</error>
class X<T : Foo>
class Y<<error>T</error> : Foo> where T : Bar<Foo>