FIR checker: warn unnecessary non-null assertions

This commit is contained in:
Jinseong Jeon
2021-04-01 11:44:47 -07:00
committed by Mikhail Glukhikh
parent 5229d4e4f4
commit 2ecb6733ed
72 changed files with 268 additions and 246 deletions
@@ -2,7 +2,7 @@ fun bar(x: Int) = x + 1
fun f1(x: Int?) {
<!INAPPLICABLE_CANDIDATE!>bar<!>(x)
if (x != null) bar(x!!)
if (x != null) bar(x<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!>)
if (x == null) bar(x!!)
}
@@ -11,13 +11,13 @@ fun f2(x: Int?) {
}
fun f3(x: Int?) {
if (x != null) bar(x!!) else x!!
if (x != null) bar(x<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!>) else x!!
}
fun f4(x: Int?) {
if (x == null) x!! else bar(x!!)
if (x == null) x!! else bar(x<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!>)
}
fun f5(x: Int?) {
if (x == null) else bar(x!!)
if (x == null) else bar(x<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!>)
}