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:
committed by
teamcityserver
parent
c7272f6986
commit
263b876e6e
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user