JET-84 Support generic parameter constraints for class objects
JET-89 Report a warning is the only upper bound is final JET-87 Support where-clause for generic parameter constraints
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
namespace boundsWithSubstitutors {
|
||||
class A<T>
|
||||
open class A<T>
|
||||
class B<X : A<X>>()
|
||||
|
||||
class C : A<C>
|
||||
@@ -15,8 +15,8 @@ namespace boundsWithSubstitutors {
|
||||
|
||||
}
|
||||
|
||||
class A
|
||||
class B<T : A>()
|
||||
open class A {}
|
||||
open class B<T : A>()
|
||||
|
||||
class C<T : B<<error>Int</error>>, X : {(B<<error>Char</error>>) : (B<<error>Any</error>>, B<A>)}>() : B<<error>Any</error>>() { // 2 errors
|
||||
val a = new B<<error>Char</error>>() // error
|
||||
@@ -37,4 +37,4 @@ fun test() {
|
||||
|
||||
fun foo<T : Any>() {}
|
||||
fun bar<T : Int?>() {}
|
||||
fun <T : Int> Int.buzz() : Unit {}
|
||||
fun <T : <warning>Int</warning>> Int.buzz() : Unit {}
|
||||
|
||||
@@ -39,9 +39,34 @@ fun test() {
|
||||
|
||||
class Foo() {}
|
||||
|
||||
class Bar<T : Foo>
|
||||
class Bar<T : <warning>Foo</warning>>
|
||||
|
||||
class Buzz<T> where T : Bar<<error>Int</error>>, T : <error>nioho</error>
|
||||
class Buzz<T> where T : <warning>Bar<<error>Int</error>></warning>, T : <error>nioho</error>
|
||||
|
||||
class X<T : Foo>
|
||||
class Y<<error>T</error> : Foo> where T : Bar<Foo>
|
||||
class X<T : <warning>Foo</warning>>
|
||||
class Y<<error>T</error> : <warning>Foo</warning>> where T : <warning>Bar<Foo></warning>
|
||||
|
||||
fun <T : A>
|
||||
where
|
||||
T : B,
|
||||
<error>B</error> : T,
|
||||
class object <error>B</error> : T,
|
||||
class object T : B,
|
||||
class object T : A
|
||||
test2(t : T) {
|
||||
T.foo()
|
||||
T.bar()
|
||||
t.foo()
|
||||
t.bar()
|
||||
}
|
||||
|
||||
val test1 = test2<<error>A</error>>(new A())
|
||||
val test2 = test2<<error>B</error>>(new B())
|
||||
val test3 = test2<C>(new C())
|
||||
|
||||
class Test<<error>T</error>>
|
||||
where
|
||||
class object T : <error>Foo</error>,
|
||||
class object T : A {}
|
||||
|
||||
val <T, B : T> x : Int
|
||||
Reference in New Issue
Block a user