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:
+17
@@ -0,0 +1,17 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER,-UNUSED_VARIABLE
|
||||
|
||||
fun <T : CharSequence?> bar1(x: T) {}
|
||||
|
||||
fun bar2(x: CharSequence?) {}
|
||||
|
||||
fun <T : CharSequence> bar3(x: T) {}
|
||||
|
||||
fun bar4(x: String) {}
|
||||
|
||||
fun <T : String?> foo(x: T) {
|
||||
bar1(x)
|
||||
bar2(x)
|
||||
|
||||
<!TYPE_INFERENCE_UPPER_BOUND_VIOLATED!>bar3<!>(x)
|
||||
bar4(<!TYPE_MISMATCH!>x<!>)
|
||||
}
|
||||
Reference in New Issue
Block a user