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
@@ -137,7 +137,7 @@ fun case_10(x: Any?, z: Any, b: Boolean?) {
// TESTCASE NUMBER: 11
fun case_11(x: Any?, z: Any, b: Boolean?) {
while (true) {
var y = x ?: if (b == true) continue!! else if (!(b != false)) return else break ?: break::class
var y = x ?: if (b == true) continue<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!> else if (!(b != false)) return else break ?: break::class
z !== y && if (b == true) return else if (b === false) null!!else throw Exception()
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Any")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any")!>y<!>
@@ -148,7 +148,7 @@ fun case_11(x: Any?, z: Any, b: Boolean?) {
// TESTCASE NUMBER: 12
fun case_12(x: Any?, z: Any, b: Boolean?) {
while (true) {
var y = select(x) ?: if (b == true) continue!! else if (!(b != false)) return else break ?: break::class
var y = select(x) ?: if (b == true) continue<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!> else if (!(b != false)) return else break ?: break::class
select(z) !== y && if (b == true) return else if (b === false) null!!else throw Exception()
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any?")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any")!>y<!>