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
This commit is contained in:
Denis Zharkov
2015-08-26 11:22:40 +03:00
parent a906be6dd7
commit 6ecfa6e985
11 changed files with 184 additions and 3 deletions
@@ -0,0 +1,13 @@
// !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<!>>) {}