[FIR] Add BOUNDS_NOT_ALLOWED_IF_BOUNDED_BY_TYPE_PARAMETER diagnostic

This commit is contained in:
Andrey Zinovyev
2021-04-07 08:19:31 +00:00
committed by Space
parent b0f1ddc91e
commit 0f04fac5b2
10 changed files with 76 additions and 8 deletions
@@ -3,13 +3,13 @@ interface I2
open class C
interface A1<K, V> where V : K, V : K
interface A2<K, V, W> where W : K, W : V
interface A3<K, V> where V : I1, V : K, V : I2
interface A4<K, V> where K : I1, K : I2, K : C, K : V, V : I2, V : I1
interface A2<K, V, W> where W : K, W : <!BOUNDS_NOT_ALLOWED_IF_BOUNDED_BY_TYPE_PARAMETER!>V<!>
interface A3<K, <!BOUNDS_NOT_ALLOWED_IF_BOUNDED_BY_TYPE_PARAMETER!>V<!>> where V : I1, V : K, V : I2
interface A4<<!BOUNDS_NOT_ALLOWED_IF_BOUNDED_BY_TYPE_PARAMETER!>K<!>, V> where K : I1, K : I2, K : C, K : V, V : I2, V : I1
fun <K, V> f1() where V : K, V : K {}
fun <K, V, W> f2() where W : K, W : V {
fun <T> f3() where T : K, T : V {}
fun <K, V, W> f2() where W : K, W : <!BOUNDS_NOT_ALLOWED_IF_BOUNDED_BY_TYPE_PARAMETER!>V<!> {
fun <T> f3() where T : K, T : <!BOUNDS_NOT_ALLOWED_IF_BOUNDED_BY_TYPE_PARAMETER!>V<!> {}
fun <T> f4() where T : K, T : K {}
}
fun <K, V, W> f3() where W : K, W : V, W : Any {}
fun <K, V, <!BOUNDS_NOT_ALLOWED_IF_BOUNDED_BY_TYPE_PARAMETER!>W<!>> f3() where W : K, W : V, W : Any {}
@@ -1,6 +1,6 @@
class Foo<T : Cloneable> where T : Comparable<T> {
fun <U : Cloneable> foo(u: U): U where U: Comparable<U> {
fun <T: Any> bar() where T: U {}
fun <<!BOUNDS_NOT_ALLOWED_IF_BOUNDED_BY_TYPE_PARAMETER!>T: Any<!>> bar() where T: U {}
return u
}
@@ -10,4 +10,4 @@ class Foo<T : Cloneable> where T : Comparable<T> {
class Bar<T : Cloneable, U> where U: Comparable<T> {
}
}