[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
@@ -13,8 +13,8 @@ fun case_1(x: Nothing?) {
// TESTCASE NUMBER: 2
fun case_2(x: Nothing) {
if (x is Unit) {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing & kotlin.Nothing")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing & kotlin.Nothing")!>x<!>.inv()
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing")!>x<!>.inv()
}
}
@@ -29,16 +29,16 @@ fun case_3(x: Nothing?) {
// TESTCASE NUMBER: 4
fun case_4(x: Nothing) {
if (x !is EnumClass) else {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing & kotlin.Nothing")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing & kotlin.Nothing")!>x<!>.<!UNRESOLVED_REFERENCE!>fun_1<!>()
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing")!>x<!>.<!UNRESOLVED_REFERENCE!>fun_1<!>()
}
}
// TESTCASE NUMBER: 5
fun case_5(x: Nothing?) {
if (!(x !is Class.NestedClass?)) {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing? & kotlin.Nothing?")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing? & kotlin.Nothing?")!>x<!>?.<!UNRESOLVED_REFERENCE!>prop_4<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing?")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing?")!>x<!>?.<!UNRESOLVED_REFERENCE!>prop_4<!>
}
}
@@ -53,24 +53,24 @@ fun case_6(x: Nothing?) {
// TESTCASE NUMBER: 7
fun case_7(x: Nothing) {
if (!(x is DeepObject.A.B.C.D.E.F.G.J)) else {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing & kotlin.Nothing")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing & kotlin.Nothing")!>x<!>.<!UNRESOLVED_REFERENCE!>prop_1<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing")!>x<!>.<!UNRESOLVED_REFERENCE!>prop_1<!>
}
}
// TESTCASE NUMBER: 8
fun case_8(x: Nothing?) {
if (!(x is Int?)) else {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing? & kotlin.Nothing?")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing? & kotlin.Nothing?")!>x<!>?.inv()
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing?")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing?")!>x<!>?.inv()
}
}
// TESTCASE NUMBER: 9
fun case_9(x: Nothing?) {
if (!!(x !is TypealiasNullableStringIndirect?)) else {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing? & kotlin.Nothing?")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing? & kotlin.Nothing?")!>x<!>?.<!UNRESOLVED_REFERENCE!>length<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing?")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing?")!>x<!>?.<!UNRESOLVED_REFERENCE!>length<!>
}
}
@@ -86,8 +86,8 @@ fun case_10(x: Nothing?) {
// TESTCASE NUMBER: 11
fun case_11(x: Nothing?) {
if (x is SealedMixedChildObject1?) {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing? & kotlin.Nothing?")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing? & kotlin.Nothing?")!>x<!>?.<!UNRESOLVED_REFERENCE!>prop_1<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing? & kotlin.Nothing?")!>x<!>?.<!UNRESOLVED_REFERENCE!>prop_2<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing?")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing?")!>x<!>?.<!UNRESOLVED_REFERENCE!>prop_1<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing?")!>x<!>?.<!UNRESOLVED_REFERENCE!>prop_2<!>
}
}