[FIR] Consider Nothing? as null constant in DFA, ^KT-44561 Fixed

This commit is contained in:
Ivan Kochurkin
2021-12-15 19:26:07 +03:00
committed by teamcity
parent 68f3ab2622
commit 84927e10b0
19 changed files with 926 additions and 922 deletions
@@ -46,9 +46,9 @@ fun case_4() {
*/
fun case_5() {
var x: Int? = null
if (<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!>x<!> == try { x = 10; null } finally {} && x != null) {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int? & kotlin.Int")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int? & kotlin.Int")!>x<!>.inv()
if (<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!>x<!> == try { x = 10; null } finally {} && <!SENSELESS_COMPARISON!>x != null<!>) {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int? & kotlin.Nothing")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int? & kotlin.Nothing")!>x<!>.inv()
}
}
@@ -49,9 +49,9 @@ fun case_3() {
*/
fun case_4() {
var x: Int? = null
if (x == try { x = 10; null } finally {} && x != null) {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int? & kotlin.Int")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int? & kotlin.Int")!>x<!>.inv()
if (x == try { x = 10; null } finally {} && <!SENSELESS_COMPARISON!>x != null<!>) {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int? & kotlin.Nothing")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int? & kotlin.Nothing")!>x<!>.inv()
println(1)
}
}
@@ -10,8 +10,8 @@
fun case_1(x: ClassWithCustomEquals) {
val y = null
if (<!SENSELESS_COMPARISON!>x == y<!>) {
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals")!>x<!>.<!UNRESOLVED_REFERENCE!>inv<!>()
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals & kotlin.Nothing")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals & kotlin.Nothing")!>x<!>.inv()
}
}
@@ -30,8 +30,8 @@ fun case_2(x: ClassWithCustomEquals) {
*/
fun case_3(x: ClassWithCustomEquals, y: Nothing?) {
if (<!SENSELESS_COMPARISON!>x == y<!>) {
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals")!>x<!>.<!UNRESOLVED_REFERENCE!>inv<!>()
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals & kotlin.Nothing")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals & kotlin.Nothing")!>x<!>.inv()
}
}
@@ -43,8 +43,8 @@ fun case_3(x: ClassWithCustomEquals, y: Nothing?) {
fun case_4(x: ClassWithCustomEquals) {
val y = null
if (<!SENSELESS_COMPARISON!>y == x<!>) {
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals")!>x<!>.<!UNRESOLVED_REFERENCE!>inv<!>()
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals & kotlin.Nothing")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals & kotlin.Nothing")!>x<!>.inv()
}
}
@@ -55,8 +55,8 @@ fun case_4(x: ClassWithCustomEquals) {
*/
fun case_5(x: ClassWithCustomEquals, y: Nothing?) {
if (<!SENSELESS_COMPARISON!>y == x<!>) {
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals")!>x<!>.<!UNRESOLVED_REFERENCE!>inv<!>()
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals & kotlin.Nothing")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals & kotlin.Nothing")!>x<!>.inv()
}
}
@@ -68,8 +68,8 @@ fun case_5(x: ClassWithCustomEquals, y: Nothing?) {
fun case_6(x: ClassWithCustomEquals) {
val y = null
if (<!SENSELESS_COMPARISON!>x == y<!> == true) {
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals")!>x<!>.<!UNRESOLVED_REFERENCE!>inv<!>()
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals & kotlin.Nothing")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals & kotlin.Nothing")!>x<!>.inv()
}
}
@@ -88,8 +88,8 @@ fun case_7(x: ClassWithCustomEquals) {
*/
fun case_8(x: ClassWithCustomEquals, y: Nothing?) {
if (!(<!SENSELESS_COMPARISON!>y == x<!>) == false) {
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals")!>x<!>.<!UNRESOLVED_REFERENCE!>inv<!>()
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals & kotlin.Nothing")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals & kotlin.Nothing")!>x<!>.inv()
}
}
@@ -24,8 +24,8 @@ fun case_1(x: Int?) {
*/
fun case_2(x: Int?, y: Nothing?) {
if (x == y) {
stringArg(<!ARGUMENT_TYPE_MISMATCH, DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int")!>x!!<!>)
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int? & kotlin.Int")!>x<!>
stringArg(<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing")!>x!!<!>)
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int? & kotlin.Nothing")!>x<!>
}
}
@@ -23,7 +23,7 @@ fun case_1(x: Int?) {
*/
fun case_2(x: Int?, y: Nothing?) {
if (x == y) {
nullableStringArg(<!ARGUMENT_TYPE_MISMATCH, DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!>x<!>)
nullableStringArg(<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int? & kotlin.Nothing?")!>x<!>)
}
}
@@ -49,8 +49,8 @@ fun case_3(y: Nothing?) {
break@outer
}
}
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String?")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String?")!>x<!><!UNSAFE_CALL!>.<!>length
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String? & kotlin.Nothing?")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String? & kotlin.Nothing?")!>x<!><!UNSAFE_CALL!>.<!>length
}
/*
@@ -68,8 +68,8 @@ fun case_4(y: Nothing?) {
}
}
}
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String?")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String?")!>x<!><!UNSAFE_CALL!>.<!>length
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String? & kotlin.Nothing?")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String? & kotlin.Nothing?")!>x<!><!UNSAFE_CALL!>.<!>length
}
// TESTCASE NUMBER: 5