[FIR] Consider Nothing? as null constant in DFA, ^KT-44561 Fixed

This commit is contained in:
Ivan Kochurkin
2021-12-15 19:26:07 +03:00
committed by teamcity
parent 68f3ab2622
commit 84927e10b0
19 changed files with 926 additions and 922 deletions
@@ -2,7 +2,7 @@ fun test() {
val out : Int? = null
val x : Nothing? = null
if (out != x)
out<!UNSAFE_CALL!>.<!>plus(1)
out.plus(1)
if (out == x) return
out<!UNSAFE_CALL!>.<!>plus(1)
out.plus(1)
}
@@ -14,12 +14,12 @@ fun foo(x : String?, y : String?) {
}
else {
// y == null but x != y
x<!UNSAFE_CALL!>.<!>length
x.length
y<!UNSAFE_CALL!>.<!>length
}
if (y == null && x != y) {
// y == null but x != y
x<!UNSAFE_CALL!>.<!>length
x.length
y<!UNSAFE_CALL!>.<!>length
}
else {
@@ -3,7 +3,7 @@ fun foo(x: String?, y: String?, z: String?, w: String?) {
z.length
else
z<!UNSAFE_CALL!>.<!>length
if (x != null || y != null || (x != z && y != z))
if (x != null || y != null || (x != z && <!SENSELESS_COMPARISON!>y != z<!>))
z<!UNSAFE_CALL!>.<!>length
else
z<!UNSAFE_CALL!>.<!>length
@@ -20,6 +20,6 @@ fun bar(i: TestWithEquals?) {
fun gav(i: TestWithEquals?, j: TestWithEquals?) {
if (j == null) {
if (i == j) foo(<!ARGUMENT_TYPE_MISMATCH!>i<!>)
if (i == j) foo(i)
}
}