Files
kotlin-fork/compiler/testData/diagnostics/tests/generics/nullability/declarationsBoundsViolation.kt
T
Denis Zharkov 6ecfa6e985 Refine subtyping check: pay attention to corresponding supertype nullability
F: Any, T : F? => !isSubtype(T, Any)

It helps to identify upper bounds violation like in KT-7455

 #KT-7455 Fixed
 #KT-2924 Fixed
 #KT-3015 Fixed
2015-08-28 18:50:25 +03:00

14 lines
439 B
Kotlin
Vendored

// !DIAGNOSTICS: -UNUSED_PARAMETER
interface A<T : CharSequence>
fun <S : CharSequence?> foo1(a: A<<!UPPER_BOUND_VIOLATED!>S<!>>) {}
class B1<E : String?> : A<<!UPPER_BOUND_VIOLATED!>E<!>>
class B2<E : CharSequence?> : A<<!UPPER_BOUND_VIOLATED!>E<!>>
class B3<E> : A<<!UPPER_BOUND_VIOLATED!>E<!>>
class B4<E : CharSequence> : A<E>
fun <X : CharSequence, Y1 : X, Y2: Y1?> foo(a: A<X>, b: A<Y1>, c: A<<!UPPER_BOUND_VIOLATED!>Y2<!>>) {}