[FIR] Don't create smartcast node if smartcasted type is equal to original type

This commit is contained in:
Dmitriy Novozhilov
2021-02-19 17:47:44 +03:00
parent 1c0d862e40
commit 469252f6b4
30 changed files with 272 additions and 271 deletions
@@ -25,8 +25,8 @@ fun case_3() {
var x: Boolean? = true
if (<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Boolean?")!>x<!> is Boolean) {
funWithAnyArg(try { x = null; true } catch (e: Exception) { false })
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Boolean? & kotlin.Boolean?")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Boolean? & kotlin.Boolean?")!>x<!><!UNSAFE_CALL!>.<!>not()
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Boolean?")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Boolean?")!>x<!><!UNSAFE_CALL!>.<!>not()
}
}
@@ -35,8 +35,8 @@ fun case_4() {
var x: Boolean? = true
if (<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Boolean?")!>x<!> != null) {
false || when { else -> {x = null; true} }
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Boolean? & kotlin.Boolean?")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Boolean? & kotlin.Boolean?")!>x<!><!UNSAFE_CALL!>.<!>not()
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Boolean?")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Boolean?")!>x<!><!UNSAFE_CALL!>.<!>not()
}
}
@@ -57,8 +57,8 @@ fun case_6() {
var x: Boolean? = true
x as Boolean
if (if (true) { x = null; true } else { false }) {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Boolean? & kotlin.Boolean?")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Boolean? & kotlin.Boolean?")!>x<!><!UNSAFE_CALL!>.<!>not()
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Boolean?")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Boolean?")!>x<!><!UNSAFE_CALL!>.<!>not()
}
}
@@ -68,6 +68,6 @@ fun case_7() {
x!!
if (if (true) { x = null; true } else { false }) {}
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Boolean? & kotlin.Boolean?")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Boolean? & kotlin.Boolean?")!>x<!><!UNSAFE_CALL!>.<!>not()
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Boolean?")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Boolean?")!>x<!><!UNSAFE_CALL!>.<!>not()
}