FIR checker: warn unnecessary non-null assertions
This commit is contained in:
committed by
Mikhail Glukhikh
parent
5229d4e4f4
commit
2ecb6733ed
@@ -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!>!!<!>)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user