FIR: extends scope of SENSELESS_COMPARISON

FE1.0 only reports SENSELESS_COMPARISON if one of the operand is `null`.
This change makes FIR reports also in case one of the operand has type
`Nothing?`.

In addition, fix handling of type alias in ConeTypeContext#isNullableType
This commit is contained in:
Tianyu Geng
2021-07-28 13:29:37 -07:00
committed by teamcityserver
parent c7272f6986
commit 263b876e6e
16 changed files with 97 additions and 98 deletions
@@ -225,8 +225,8 @@ fun case_23(value_1: Nothing) {
// TESTCASE NUMBER: 24
fun case_24(value_1: Nothing?) = when (value_1) {
throw Exception(), <!RETURN_IN_FUNCTION_WITH_EXPRESSION_BODY!>return<!> "" -> ""
<!SENSELESS_NULL_IN_WHEN!>null<!>, <!RETURN_IN_FUNCTION_WITH_EXPRESSION_BODY!>return<!> <!RETURN_IN_FUNCTION_WITH_EXPRESSION_BODY!>return<!> <!RETURN_IN_FUNCTION_WITH_EXPRESSION_BODY!>return<!> "", throw throw throw Exception() -> ""
<!SENSELESS_COMPARISON!>throw Exception()<!>, <!SENSELESS_COMPARISON!><!RETURN_IN_FUNCTION_WITH_EXPRESSION_BODY!>return<!> ""<!> -> ""
<!SENSELESS_NULL_IN_WHEN!>null<!>, <!SENSELESS_COMPARISON!><!RETURN_IN_FUNCTION_WITH_EXPRESSION_BODY!>return<!> <!RETURN_IN_FUNCTION_WITH_EXPRESSION_BODY!>return<!> <!RETURN_IN_FUNCTION_WITH_EXPRESSION_BODY!>return<!> ""<!>, <!SENSELESS_COMPARISON!>throw throw throw Exception()<!> -> ""
else -> ""
}
@@ -23,8 +23,8 @@ fun case_3(value_1: String?, value_2: Boolean): Boolean {
// TESTCASE NUMBER: 4
fun case_4(value_1: Nothing?, value_2: Boolean?): Boolean? {
contract { <!ERROR_IN_CONTRACT_DESCRIPTION!>returns(null) implies (<!SENSELESS_COMPARISON!>value_1 == null<!> || value_2 != null || value_2 == false)<!> }
return if (<!SENSELESS_COMPARISON!>value_1 == null<!> || value_2 != null || value_2 == false) null else true
contract { <!ERROR_IN_CONTRACT_DESCRIPTION!>returns(null) implies (<!SENSELESS_COMPARISON!>value_1 == null<!> || value_2 != null || <!SENSELESS_COMPARISON!>value_2 == false<!>)<!> }
return if (<!SENSELESS_COMPARISON!>value_1 == null<!> || value_2 != null || <!SENSELESS_COMPARISON!>value_2 == false<!>) null else true
}
// TESTCASE NUMBER: 5
@@ -87,7 +87,7 @@ fun case_6(x: EmptyClass?) {
// TESTCASE NUMBER: 7
fun case_7() {
if (nullableNumberProperty != null || <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Number? & kotlin.Nothing?")!>nullableNumberProperty<!> != null is Boolean) {
if (nullableNumberProperty != null || <!SENSELESS_COMPARISON!><!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Number? & kotlin.Nothing?")!>nullableNumberProperty<!> != null is Boolean<!>) {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Number?")!>nullableNumberProperty<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Number?")!>nullableNumberProperty<!><!UNSAFE_CALL!>.<!>equals(null)
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Number?")!>nullableNumberProperty<!>.propT
@@ -103,8 +103,8 @@ fun case_7() {
// TESTCASE NUMBER: 8
fun case_8(x: TypealiasNullableString) {
if (<!SENSELESS_COMPARISON!><!SENSELESS_COMPARISON!>x !== null<!> === null<!> && <!SENSELESS_COMPARISON!><!SENSELESS_COMPARISON!><!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableString")!>x<!> != null<!> != null<!>) <!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableString")!>x<!><!UNSAFE_CALL!>.<!>get(0)
if (<!SENSELESS_COMPARISON!><!SENSELESS_COMPARISON!>x !== null<!> != null<!> && <!SENSELESS_COMPARISON!><!SENSELESS_COMPARISON!><!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableString")!>x<!> != null<!> === null<!>) <!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableString")!>x<!><!UNSAFE_CALL!>.<!>get(0)
if (<!SENSELESS_COMPARISON!>x !== null === null<!> && <!SENSELESS_COMPARISON!><!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableString")!>x<!> != null != null<!>) <!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableString")!>x<!><!UNSAFE_CALL!>.<!>get(0)
if (<!SENSELESS_COMPARISON!>x !== null != null<!> && <!SENSELESS_COMPARISON!><!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableString")!>x<!> != null === null<!>) <!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableString")!>x<!><!UNSAFE_CALL!>.<!>get(0)
}
// TESTCASE NUMBER: 9
@@ -165,17 +165,17 @@ fun case_11(x: TypealiasNullableStringIndirect?, y: TypealiasNullableStringIndir
// TESTCASE NUMBER: 12
fun case_12(x: TypealiasNullableStringIndirect, y: TypealiasNullableStringIndirect) =
if (<!USELESS_IS_CHECK!>(<!SENSELESS_COMPARISON!>x == null<!>) !is Boolean<!> === false) "1"
else if (<!USELESS_IS_CHECK!>(<!SENSELESS_COMPARISON!><!SENSELESS_COMPARISON!>y === null<!> !== null<!>) is Boolean<!>) <!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableStringIndirect")!>x<!>
else if (<!SENSELESS_COMPARISON!><!SENSELESS_COMPARISON!>y === null<!> != null<!>) <!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableStringIndirect")!>x<!>.equals(null)
else if (<!SENSELESS_COMPARISON!><!SENSELESS_COMPARISON!>y === null<!> != null<!>) <!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableStringIndirect")!>x<!>.propT
else if (<!SENSELESS_COMPARISON!><!SENSELESS_COMPARISON!>y === null<!> != null<!>) <!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableStringIndirect")!>x<!><!UNSAFE_CALL!>.<!>propAny
else if (<!SENSELESS_COMPARISON!><!SENSELESS_COMPARISON!>y === null<!> != null<!>) <!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableStringIndirect")!>x<!>.propNullableT
else if (<!SENSELESS_COMPARISON!><!SENSELESS_COMPARISON!>y === null<!> != null<!>) <!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableStringIndirect")!>x<!>.propNullableAny
else if (<!SENSELESS_COMPARISON!><!SENSELESS_COMPARISON!>y === null<!> != null<!>) <!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableStringIndirect")!>x<!>.funT()
else if (<!SENSELESS_COMPARISON!><!SENSELESS_COMPARISON!>y === null<!> != null<!>) <!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableStringIndirect")!>x<!><!UNSAFE_CALL!>.<!>funAny()
else if (<!SENSELESS_COMPARISON!><!SENSELESS_COMPARISON!>y === null<!> != null<!>) <!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableStringIndirect")!>x<!>.funNullableT()
else if (<!SENSELESS_COMPARISON!><!SENSELESS_COMPARISON!>y === null<!> != null<!>) <!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableStringIndirect")!>x<!>.funNullableAny()
if (<!USELESS_IS_CHECK!>(x == null) !is Boolean<!> === false) "1"
else if (<!USELESS_IS_CHECK!>(<!SENSELESS_COMPARISON!>y === null !== null<!>) is Boolean<!>) <!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableStringIndirect")!>x<!>
else if (<!SENSELESS_COMPARISON!>y === null != null<!>) <!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableStringIndirect")!>x<!>.equals(null)
else if (<!SENSELESS_COMPARISON!>y === null != null<!>) <!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableStringIndirect")!>x<!>.propT
else if (<!SENSELESS_COMPARISON!>y === null != null<!>) <!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableStringIndirect")!>x<!><!UNSAFE_CALL!>.<!>propAny
else if (<!SENSELESS_COMPARISON!>y === null != null<!>) <!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableStringIndirect")!>x<!>.propNullableT
else if (<!SENSELESS_COMPARISON!>y === null != null<!>) <!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableStringIndirect")!>x<!>.propNullableAny
else if (<!SENSELESS_COMPARISON!>y === null != null<!>) <!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableStringIndirect")!>x<!>.funT()
else if (<!SENSELESS_COMPARISON!>y === null != null<!>) <!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableStringIndirect")!>x<!><!UNSAFE_CALL!>.<!>funAny()
else if (<!SENSELESS_COMPARISON!>y === null != null<!>) <!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableStringIndirect")!>x<!>.funNullableT()
else if (<!SENSELESS_COMPARISON!>y === null != null<!>) <!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableStringIndirect")!>x<!>.funNullableAny()
else "-1"
// TESTCASE NUMBER: 13
@@ -9,7 +9,7 @@
*/
fun case_1(x: ClassWithCustomEquals) {
val y = null
if (x == y) {
if (<!SENSELESS_COMPARISON!>x == y<!>) {
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals")!>x<!>.<!UNRESOLVED_REFERENCE!>inv<!>()
}
@@ -29,7 +29,7 @@ fun case_2(x: ClassWithCustomEquals) {
* ISSUES: KT-28243
*/
fun case_3(x: ClassWithCustomEquals, y: Nothing?) {
if (x == y) {
if (<!SENSELESS_COMPARISON!>x == y<!>) {
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals")!>x<!>.<!UNRESOLVED_REFERENCE!>inv<!>()
}
@@ -42,7 +42,7 @@ fun case_3(x: ClassWithCustomEquals, y: Nothing?) {
*/
fun case_4(x: ClassWithCustomEquals) {
val y = null
if (y == x) {
if (<!SENSELESS_COMPARISON!>y == x<!>) {
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals")!>x<!>.<!UNRESOLVED_REFERENCE!>inv<!>()
}
@@ -54,7 +54,7 @@ fun case_4(x: ClassWithCustomEquals) {
* ISSUES: KT-28243
*/
fun case_5(x: ClassWithCustomEquals, y: Nothing?) {
if (y == x) {
if (<!SENSELESS_COMPARISON!>y == x<!>) {
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals")!>x<!>.<!UNRESOLVED_REFERENCE!>inv<!>()
}
@@ -67,7 +67,7 @@ fun case_5(x: ClassWithCustomEquals, y: Nothing?) {
*/
fun case_6(x: ClassWithCustomEquals) {
val y = null
if (x == y == true) {
if (<!SENSELESS_COMPARISON!>x == y<!> == true) {
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals")!>x<!>.<!UNRESOLVED_REFERENCE!>inv<!>()
}
@@ -87,7 +87,7 @@ fun case_7(x: ClassWithCustomEquals) {
* ISSUES: KT-28243
*/
fun case_8(x: ClassWithCustomEquals, y: Nothing?) {
if (!(y == x) == false) {
if (!(<!SENSELESS_COMPARISON!>y == x<!>) == false) {
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals")!>x<!>.<!UNRESOLVED_REFERENCE!>inv<!>()
}
@@ -138,16 +138,16 @@ fun case_7() {
// TESTCASE NUMBER: 8
fun case_8(x: TypealiasNullableString) {
if (<!SENSELESS_COMPARISON!>x !== null<!> && <!SENSELESS_COMPARISON!><!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableString & kotlin.Any & TypealiasNullableString")!>x<!> != null<!>) <!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableString & kotlin.Any & TypealiasNullableString")!>x<!>
if (<!SENSELESS_COMPARISON!>x !== null<!> && <!SENSELESS_COMPARISON!><!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableString & kotlin.Any & TypealiasNullableString")!>x<!> != null<!>) <!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableString & kotlin.Any & TypealiasNullableString")!>x<!>.equals(null)
if (<!SENSELESS_COMPARISON!>x !== null<!> && <!SENSELESS_COMPARISON!><!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableString & kotlin.Any & TypealiasNullableString")!>x<!> != null<!>) <!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableString & kotlin.Any & TypealiasNullableString")!>x<!>.propT
if (<!SENSELESS_COMPARISON!>x !== null<!> && <!SENSELESS_COMPARISON!><!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableString & kotlin.Any & TypealiasNullableString")!>x<!> != null<!>) <!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableString & kotlin.Any & TypealiasNullableString")!>x<!>.propAny
if (<!SENSELESS_COMPARISON!>x !== null<!> && <!SENSELESS_COMPARISON!><!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableString & kotlin.Any & TypealiasNullableString")!>x<!> != null<!>) <!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableString & kotlin.Any & TypealiasNullableString")!>x<!>.propNullableT
if (<!SENSELESS_COMPARISON!>x !== null<!> && <!SENSELESS_COMPARISON!><!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableString & kotlin.Any & TypealiasNullableString")!>x<!> != null<!>) <!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableString & kotlin.Any & TypealiasNullableString")!>x<!>.propNullableAny
if (<!SENSELESS_COMPARISON!>x !== null<!> && <!SENSELESS_COMPARISON!><!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableString & kotlin.Any & TypealiasNullableString")!>x<!> != null<!>) <!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableString & kotlin.Any & TypealiasNullableString")!>x<!>.funT()
if (<!SENSELESS_COMPARISON!>x !== null<!> && <!SENSELESS_COMPARISON!><!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableString & kotlin.Any & TypealiasNullableString")!>x<!> != null<!>) <!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableString & kotlin.Any & TypealiasNullableString")!>x<!>.funAny()
if (<!SENSELESS_COMPARISON!>x !== null<!> && <!SENSELESS_COMPARISON!><!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableString & kotlin.Any & TypealiasNullableString")!>x<!> != null<!>) <!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableString & kotlin.Any & TypealiasNullableString")!>x<!>.funNullableT()
if (<!SENSELESS_COMPARISON!>x !== null<!> && <!SENSELESS_COMPARISON!><!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableString & kotlin.Any & TypealiasNullableString")!>x<!> != null<!>) <!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableString & kotlin.Any & TypealiasNullableString")!>x<!>.funNullableAny()
if (x !== null && <!SENSELESS_COMPARISON!><!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableString & kotlin.Any & TypealiasNullableString")!>x<!> != null<!>) <!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableString & kotlin.Any & TypealiasNullableString")!>x<!>
if (x !== null && <!SENSELESS_COMPARISON!><!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableString & kotlin.Any & TypealiasNullableString")!>x<!> != null<!>) <!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableString & kotlin.Any & TypealiasNullableString")!>x<!>.equals(null)
if (x !== null && <!SENSELESS_COMPARISON!><!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableString & kotlin.Any & TypealiasNullableString")!>x<!> != null<!>) <!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableString & kotlin.Any & TypealiasNullableString")!>x<!>.propT
if (x !== null && <!SENSELESS_COMPARISON!><!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableString & kotlin.Any & TypealiasNullableString")!>x<!> != null<!>) <!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableString & kotlin.Any & TypealiasNullableString")!>x<!>.propAny
if (x !== null && <!SENSELESS_COMPARISON!><!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableString & kotlin.Any & TypealiasNullableString")!>x<!> != null<!>) <!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableString & kotlin.Any & TypealiasNullableString")!>x<!>.propNullableT
if (x !== null && <!SENSELESS_COMPARISON!><!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableString & kotlin.Any & TypealiasNullableString")!>x<!> != null<!>) <!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableString & kotlin.Any & TypealiasNullableString")!>x<!>.propNullableAny
if (x !== null && <!SENSELESS_COMPARISON!><!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableString & kotlin.Any & TypealiasNullableString")!>x<!> != null<!>) <!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableString & kotlin.Any & TypealiasNullableString")!>x<!>.funT()
if (x !== null && <!SENSELESS_COMPARISON!><!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableString & kotlin.Any & TypealiasNullableString")!>x<!> != null<!>) <!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableString & kotlin.Any & TypealiasNullableString")!>x<!>.funAny()
if (x !== null && <!SENSELESS_COMPARISON!><!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableString & kotlin.Any & TypealiasNullableString")!>x<!> != null<!>) <!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableString & kotlin.Any & TypealiasNullableString")!>x<!>.funNullableT()
if (x !== null && <!SENSELESS_COMPARISON!><!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableString & kotlin.Any & TypealiasNullableString")!>x<!> != null<!>) <!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableString & kotlin.Any & TypealiasNullableString")!>x<!>.funNullableAny()
}
// TESTCASE NUMBER: 9
@@ -195,9 +195,9 @@ fun case_11(x: TypealiasNullableStringIndirect?, y: TypealiasNullableStringIndir
if (x == null) {
} else {
if (<!SENSELESS_COMPARISON!>y != null<!>) {
if (y != null) {
if (nullableStringProperty == null) {
if (<!SENSELESS_COMPARISON!>t != null<!>) {
if (t != null) {
<!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableStringIndirect? & kotlin.Any & TypealiasNullableStringIndirect")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableStringIndirect? & kotlin.Any & TypealiasNullableStringIndirect")!>x<!>.equals(null)
<!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableStringIndirect? & kotlin.Any & TypealiasNullableStringIndirect")!>x<!>.propT
@@ -216,8 +216,8 @@ fun case_11(x: TypealiasNullableStringIndirect?, y: TypealiasNullableStringIndir
// TESTCASE NUMBER: 12
fun case_12(x: TypealiasNullableStringIndirect, y: TypealiasNullableStringIndirect) =
if (<!SENSELESS_COMPARISON!>x == null<!>) "1"
else if (<!SENSELESS_COMPARISON!>y === null<!>) <!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableStringIndirect & kotlin.Any & TypealiasNullableStringIndirect")!>x<!>
if (x == null) "1"
else if (y === null) <!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableStringIndirect & kotlin.Any & TypealiasNullableStringIndirect")!>x<!>
else if (<!SENSELESS_COMPARISON!>y === null<!>) <!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableStringIndirect & kotlin.Any & TypealiasNullableStringIndirect")!>x<!>.equals(null)
else if (<!SENSELESS_COMPARISON!>y === null<!>) <!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableStringIndirect & kotlin.Any & TypealiasNullableStringIndirect")!>x<!>.propT
else if (<!SENSELESS_COMPARISON!>y === null<!>) <!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableStringIndirect & kotlin.Any & TypealiasNullableStringIndirect")!>x<!>.propAny
@@ -321,7 +321,7 @@ fun case_15(x: EmptyObject) {
fun case_16() {
val x: TypealiasNullableNothing = null
if (<!SENSELESS_COMPARISON!>x != null<!>) {
if (x != null) {
<!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableNothing & kotlin.Any & TypealiasNullableNothing")!>x<!>
}
}
@@ -67,7 +67,7 @@ fun case_7() {
// TESTCASE NUMBER: 8
fun case_8(x: TypealiasNullableString) {
if (<!SENSELESS_COMPARISON!>x == null<!> && <!SENSELESS_COMPARISON!><!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableString & kotlin.Nothing?")!>x<!> == null<!>)
if (x == null && <!SENSELESS_COMPARISON!><!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableString & kotlin.Nothing?")!>x<!> == null<!>)
<!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableString & kotlin.Nothing?")!>x<!>
}
@@ -102,9 +102,9 @@ fun case_11(x: TypealiasNullableString?, y: TypealiasNullableString) {
if (x != null) {
} else {
if (<!SENSELESS_COMPARISON!>y == null<!>) {
if (y == null) {
if (nullableStringProperty != null) {
if (<!SENSELESS_COMPARISON!>z == null<!>) {
if (z == null) {
<!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableString? & kotlin.Nothing?")!>x<!>
}
}
@@ -113,8 +113,8 @@ fun case_11(x: TypealiasNullableString?, y: TypealiasNullableString) {
}
// TESTCASE NUMBER: 12
fun case_12(x: TypealiasNullableString, y: TypealiasNullableString) = <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String?")!>if (<!SENSELESS_COMPARISON!>x != null<!> && true && true && true) "1"
else if (<!SENSELESS_COMPARISON!>y != null<!>) <!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableString")!>x<!>
fun case_12(x: TypealiasNullableString, y: TypealiasNullableString) = <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String?")!>if (x != null && true && true && true) "1"
else if (y != null) <!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableString")!>x<!>
else "-1"<!>
// TESTCASE NUMBER: 13
@@ -171,7 +171,7 @@ fun case_14() {
// TESTCASE NUMBER: 15
fun case_15(x: TypealiasNullableString) {
val t = <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String?")!>if (<!SENSELESS_COMPARISON!>x != null<!>) "" else {
val t = <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String?")!>if (x != null) "" else {
<!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableString & kotlin.Nothing?")!>x<!>
}<!>
}
@@ -180,7 +180,7 @@ fun case_15(x: TypealiasNullableString) {
fun case_16() {
val x: TypealiasNullableNothing = null
if (<!SENSELESS_COMPARISON!>x == null<!> || false || false || false) {
if (x == null || false || false || false) {
<!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableNothing")!>x<!>
}
}
@@ -196,10 +196,10 @@ fun case_17(x: Boolean?, y: Boolean?) {
true -> x!!
false -> x!!
null -> if (true) if (true) if (true) if (true) if (true) when (y) {
true -> when (y) {
<!SENSELESS_COMPARISON!>true<!> -> when (y) {
else -> if (true) if (true) if (true) if (true) if (true) x!! else x!! else x!! else x!! else x!! else x!!
}
false -> x!!
<!SENSELESS_COMPARISON!>false<!> -> x!!
<!SENSELESS_NULL_IN_WHEN!>null<!> -> if (true) if (true) if (true) if (true) if (true) x!! else x!! else x!! else x!! else x!! else x!!
} else x!! else x!! else x!! else x!! else x!!
}
@@ -38,7 +38,7 @@ fun case_1(x: Any?) {
*/
fun case_2(x: Nothing?) {
val y = null
if (x !== y) {
if (<!SENSELESS_COMPARISON!>x !== y<!>) {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing?")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing?")!>x<!>.hashCode()
}
@@ -221,7 +221,7 @@ fun case_11(x: TypealiasNullableString?, y: TypealiasNullableString) {
// TESTCASE NUMBER: 12
fun case_12(x: TypealiasNullableString, y: TypealiasNullableString, z1: Nothing?, z2: Nothing?) = if (x == z1 || x == z2) "1"
else if (y === z1 && y == z2) {
else if (y === z1 && <!SENSELESS_COMPARISON!>y == z2<!>) {
<!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableString")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableString")!>x<!>.equals(null)
<!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableString")!>x<!>.propT
@@ -281,7 +281,7 @@ fun case_14() {
// TESTCASE NUMBER: 15
fun case_15(x: TypealiasNullableString) {
val y = null
val z = if (<!SENSELESS_COMPARISON!>x === null<!> || y == x && x === y || <!SENSELESS_COMPARISON!>null === x<!>) "" else {
val z = if (x === null || <!SENSELESS_COMPARISON!>y == x<!> && x === y || <!SENSELESS_COMPARISON!>null === x<!>) "" else {
<!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableString & kotlin.Any & TypealiasNullableString")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableString & kotlin.Any & TypealiasNullableString")!>x<!>.equals(null)
<!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableString & kotlin.Any & TypealiasNullableString")!>x<!>.propT
@@ -677,7 +677,7 @@ fun case_33(a: ((Float) -> Int?)?, b: Float?, c: Boolean?) {
fun case_34(z1: Boolean?) {
var z = null
if (true && true && true && true && EnumClassWithNullableProperty.A.prop_1 != implicitNullableNothingProperty && EnumClassWithNullableProperty.A.prop_1 !== null && EnumClassWithNullableProperty.A.prop_1 !== z || z1 != implicitNullableNothingProperty || z1!! && true && true) {
if (true && true && true && true && EnumClassWithNullableProperty.A.prop_1 != implicitNullableNothingProperty && EnumClassWithNullableProperty.A.prop_1 !== null && <!SENSELESS_COMPARISON!>EnumClassWithNullableProperty.A.prop_1 !== z<!> || z1 != implicitNullableNothingProperty || z1!! && true && true) {
} else {
EnumClassWithNullableProperty.A.prop_1
@@ -712,7 +712,7 @@ fun case_35(a: DeepObject.A.B.C.D.E.F.G.J?) {
fun case_36(x: Any) {
var z = null
if (x == z) {
if (<!SENSELESS_COMPARISON!>x == z<!>) {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any")!>x<!>.<!UNRESOLVED_REFERENCE!>java<!>
}
@@ -720,7 +720,7 @@ fun case_36(x: Any) {
// TESTCASE NUMBER: 37
fun case_37(x: Nothing?, y: Nothing?) {
if (x == y) {
if (<!SENSELESS_COMPARISON!>x == y<!>) {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing?")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing?")!>x<!>.hashCode()
}
@@ -733,7 +733,7 @@ fun case_37(x: Nothing?, y: Nothing?) {
fun case_38() {
val z = null
if (Object.prop_2 != z)
if (<!SENSELESS_COMPARISON!>Object.prop_2 != z<!>)
else {
Object.prop_2
Object.prop_2.<!UNRESOLVED_REFERENCE!>java<!>
@@ -771,7 +771,7 @@ fun case_41(x: EmptyClass?, z: Nothing?) {
// TESTCASE NUMBER: 42
fun case_42() {
if (EmptyObject == nullableNothingProperty || <!DEBUG_INFO_EXPRESSION_TYPE("EmptyObject")!>EmptyObject<!> === nullableNothingProperty) {
if (<!SENSELESS_COMPARISON!>EmptyObject == nullableNothingProperty<!> || <!SENSELESS_COMPARISON!><!DEBUG_INFO_EXPRESSION_TYPE("EmptyObject")!>EmptyObject<!> === nullableNothingProperty<!>) {
<!DEBUG_INFO_EXPRESSION_TYPE("EmptyObject")!>EmptyObject<!>
<!DEBUG_INFO_EXPRESSION_TYPE("EmptyObject")!>EmptyObject<!>.equals(null)
<!DEBUG_INFO_EXPRESSION_TYPE("EmptyObject")!>EmptyObject<!>.propT
@@ -992,7 +992,7 @@ fun case_56() {
fun case_57(a: (() -> Unit)) {
var z = null
if (a == z) {
if (<!SENSELESS_COMPARISON!>a == z<!>) {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Function0<kotlin.Unit>")!>a<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Function0<kotlin.Unit>")!>a<!>.<!UNRESOLVED_REFERENCE!>java<!>
}
@@ -192,9 +192,9 @@ fun case_11(x: TypealiasNullableString?, y: TypealiasNullableString) {
} else {
if (<!SENSELESS_COMPARISON!>x != null<!>) {
if (<!SENSELESS_COMPARISON!>y != null<!> || <!SENSELESS_COMPARISON!>y != null<!>) {
if (y != null || <!SENSELESS_COMPARISON!>y != null<!>) {
if (<!SENSELESS_COMPARISON!>stringProperty == null<!> && <!SENSELESS_COMPARISON!>nullableNothingProperty == null<!>) {
if (<!SENSELESS_COMPARISON!>t != null<!> || <!SENSELESS_COMPARISON!>t != null<!>) {
if (t != null || <!SENSELESS_COMPARISON!>t != null<!>) {
<!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableString? & kotlin.Any & TypealiasNullableString")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableString? & kotlin.Any & TypealiasNullableString")!>x<!>.equals(null)
<!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableString? & kotlin.Any & TypealiasNullableString")!>x<!>.propT
@@ -213,8 +213,8 @@ fun case_11(x: TypealiasNullableString?, y: TypealiasNullableString) {
}
// TESTCASE NUMBER: 12
fun case_12(x: TypealiasNullableString, y: TypealiasNullableString) = <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String")!>if (<!SENSELESS_COMPARISON!>x == null<!>) "1"
else if (<!SENSELESS_COMPARISON!>y === null<!> || <!SENSELESS_COMPARISON!>y === null<!>) {
fun case_12(x: TypealiasNullableString, y: TypealiasNullableString) = <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String")!>if (x == null) "1"
else if (y === null || <!SENSELESS_COMPARISON!>y === null<!>) {
<!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableString & kotlin.Any & TypealiasNullableString")!>x<!>.equals(null)
<!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableString & kotlin.Any & TypealiasNullableString")!>x<!>.propT
<!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableString & kotlin.Any & TypealiasNullableString")!>x<!>.propAny
@@ -229,7 +229,7 @@ fun case_12(x: TypealiasNullableString, y: TypealiasNullableString) = <!DEBUG_IN
// TESTCASE NUMBER: 13
fun case_13(x: orherpackage.EmptyClass13?, y: Nothing?) =
<!DEBUG_INFO_EXPRESSION_TYPE("orherpackage.EmptyClass13")!>if (x == null || x === y) {
<!DEBUG_INFO_EXPRESSION_TYPE("orherpackage.EmptyClass13")!>if (x == null || <!SENSELESS_COMPARISON!>x === y<!>) {
throw Exception()
} else {
<!DEBUG_INFO_EXPRESSION_TYPE("orherpackage.EmptyClass13? & orherpackage.EmptyClass13")!>x<!>.equals(null)
@@ -247,7 +247,7 @@ fun case_13(x: orherpackage.EmptyClass13?, y: Nothing?) =
// TESTCASE NUMBER: 14
fun case_14() {
val a = Class()
if (a.prop_6 != a.prop_7) {
if (<!SENSELESS_COMPARISON!>a.prop_6 != a.prop_7<!>) {
a.prop_6
a.prop_6.equals(null)
a.prop_6.propT
@@ -264,7 +264,7 @@ fun case_14() {
// TESTCASE NUMBER: 15
fun case_15(x: TypealiasString?) {
var y = null
val t = <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String")!>if (x === null || x == y && x === y) "" else {
val t = <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String")!>if (x === null || <!SENSELESS_COMPARISON!>x == y<!> && x === y) "" else {
<!DEBUG_INFO_EXPRESSION_TYPE("TypealiasString? & TypealiasString")!>x<!>.equals(null)
<!DEBUG_INFO_EXPRESSION_TYPE("TypealiasString? & TypealiasString")!>x<!>.propT
<!DEBUG_INFO_EXPRESSION_TYPE("TypealiasString? & TypealiasString")!>x<!>.propAny
@@ -290,7 +290,7 @@ fun case_16() {
}
// TESTCASE NUMBER: 17
val case_17 = <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int")!>if (nullableIntProperty == null || nullableNothingProperty === nullableIntProperty) 0 else {
val case_17 = <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int")!>if (nullableIntProperty == null || <!SENSELESS_COMPARISON!>nullableNothingProperty === nullableIntProperty<!>) 0 else {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int? & kotlin.Int")!>nullableIntProperty<!>.equals(null)
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int? & kotlin.Int")!>nullableIntProperty<!>.propT
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int? & kotlin.Int")!>nullableIntProperty<!>.propAny
@@ -309,7 +309,7 @@ val case_17 = <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int")!>if (nullableIntPropert
* ISSUES: KT-28328
*/
fun case_18(a: DeepObject.A.B.C.D.E.F.G.J?, b: Nothing?) {
if (a != null || b !== a || false) {
if (a != null || <!SENSELESS_COMPARISON!>b !== a<!> || false) {
<!DEBUG_INFO_EXPRESSION_TYPE("DeepObject.A.B.C.D.E.F.G.J?")!>a<!>
<!DEBUG_INFO_EXPRESSION_TYPE("DeepObject.A.B.C.D.E.F.G.J?")!>a<!><!UNSAFE_CALL!>.<!>equals(null)
<!DEBUG_INFO_EXPRESSION_TYPE("DeepObject.A.B.C.D.E.F.G.J?")!>a<!>.propT
@@ -371,7 +371,7 @@ fun case_20(b: Boolean) {
}
}
if (a.B19.C19.D19 !== null || a.y != a.B19.C19.D19) {
if (a.B19.C19.D19 !== null || <!SENSELESS_COMPARISON!>a.y != a.B19.C19.D19<!>) {
a.B19.C19.D19
a.B19.C19.D19<!UNSAFE_CALL!>.<!>equals(null)
a.B19.C19.D19.propT
@@ -388,7 +388,7 @@ fun case_20(b: Boolean) {
// TESTCASE NUMBER: 21
fun case_21() {
val y = null
if (EnumClassWithNullableProperty.A.prop_1 !== null && y != EnumClassWithNullableProperty.A.prop_1) {
if (EnumClassWithNullableProperty.A.prop_1 !== null && <!SENSELESS_COMPARISON!>y != EnumClassWithNullableProperty.A.prop_1<!>) {
EnumClassWithNullableProperty.A.prop_1
EnumClassWithNullableProperty.A.prop_1.equals(null)
EnumClassWithNullableProperty.A.prop_1.propT
@@ -405,7 +405,7 @@ fun case_21() {
// TESTCASE NUMBER: 22
fun case_22(a: (() -> Unit)?) {
var y = null
if (a != null || y != a) {
if (a != null || <!SENSELESS_COMPARISON!>y != a<!>) {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Unit")!><!UNSAFE_IMPLICIT_INVOKE_CALL!>a<!>()<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Function0<kotlin.Unit>?")!>a<!><!UNSAFE_CALL!>.<!>equals(null)
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Function0<kotlin.Unit>?")!>a<!>.propT
@@ -423,7 +423,7 @@ fun case_22(a: (() -> Unit)?) {
fun case_23(a: ((Float) -> Int?)?, b: Float?, c: Nothing?) {
if (a != null && b !== null || a != c && b !== c) {
val x = <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!><!UNSAFE_IMPLICIT_INVOKE_CALL!>a<!>(<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Float?")!>b<!>)<!>
if (x != null || c !== x) {
if (x != null || <!SENSELESS_COMPARISON!>c !== x<!>) {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!>x<!><!UNSAFE_CALL!>.<!>equals(null)
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!>x<!>.propT
@@ -473,7 +473,7 @@ fun case_25(b: Boolean) {
val y = if (b) x else null
if (y !== null || x()!!.b != y) {
if (y !== null || <!SENSELESS_COMPARISON!>x()!!.b != y<!>) {
if (x()!!.b != y) {
val z = <!DEBUG_INFO_EXPRESSION_TYPE("<anonymous>?")!><!UNSAFE_IMPLICIT_INVOKE_CALL!>y<!>()<!>
@@ -516,7 +516,7 @@ fun case_26(a: ((Float) -> Int?)?, b: Float?) {
// TESTCASE NUMBER: 27
fun case_27(y: Nothing?) {
if (Object.prop_1 == null == true == true == true == true == true == true == true == true == true == true == true == true == true == true || y == Object.prop_1 == true == true == true == false == false)
if (Object.prop_1 == null == true == true == true == true == true == true == true == true == true == true == true == true == true == true || <!SENSELESS_COMPARISON!>y == Object.prop_1<!> == true == true == true == false == false)
else {
Object.prop_1
Object.prop_1.equals(null)