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
@@ -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