[FIR] Implement NULL_FOR_NONNULL_TYPE diagnostics, fix tests
This commit is contained in:
-19
@@ -1,19 +0,0 @@
|
||||
// !CHECK_TYPE
|
||||
|
||||
interface A {
|
||||
val foo: Any?
|
||||
}
|
||||
|
||||
interface C: A {
|
||||
override val foo: String?
|
||||
}
|
||||
interface B: A {
|
||||
override var foo: String
|
||||
}
|
||||
|
||||
fun <T> test(a: T) where T : B, T : C {
|
||||
a.foo = ""
|
||||
a.foo = null
|
||||
|
||||
a.foo.checkType { _<String>() }
|
||||
}
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !CHECK_TYPE
|
||||
|
||||
interface A {
|
||||
|
||||
-35
@@ -1,35 +0,0 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE
|
||||
|
||||
fun <E> bar(x: E) {}
|
||||
|
||||
fun <T> foo(): T {
|
||||
val x1: T = <!INITIALIZER_TYPE_MISMATCH!>null<!>
|
||||
val x2: T? = null
|
||||
|
||||
bar<T>(<!ARGUMENT_TYPE_MISMATCH!>null<!>)
|
||||
bar<T?>(null)
|
||||
|
||||
return <!RETURN_TYPE_MISMATCH!>null<!>
|
||||
}
|
||||
|
||||
fun <T> baz(): T? = null
|
||||
|
||||
fun <T> foobar(): T = <!RETURN_TYPE_MISMATCH!>null<!>
|
||||
|
||||
class A<F> {
|
||||
fun xyz(x: F) {}
|
||||
|
||||
fun foo(): F {
|
||||
val x1: F = <!INITIALIZER_TYPE_MISMATCH!>null<!>
|
||||
val x2: F? = null
|
||||
|
||||
xyz(<!ARGUMENT_TYPE_MISMATCH!>null<!>)
|
||||
bar<F?>(null)
|
||||
|
||||
return <!RETURN_TYPE_MISMATCH!>null<!>
|
||||
}
|
||||
|
||||
fun baz(): F? = null
|
||||
|
||||
fun foobar(): F = <!RETURN_TYPE_MISMATCH!>null<!>
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE
|
||||
|
||||
fun <E> bar(x: E) {}
|
||||
|
||||
+1
-1
@@ -9,6 +9,6 @@ interface Tr<T> {
|
||||
fun test(t: Tr<*>) {
|
||||
t.v = null!!
|
||||
t.v = ""
|
||||
t.v = null
|
||||
t.v = <!NULL_FOR_NONNULL_TYPE!>null<!>
|
||||
t.v checkType { _<Any?>() }
|
||||
}
|
||||
Reference in New Issue
Block a user