[FE 1.0] Report USELESS_IS_CHECK if is expression is always false

^KT-47684 Fixed
This commit is contained in:
Dmitriy Novozhilov
2021-07-09 14:03:48 +03:00
committed by teamcityserver
parent 785e2f862c
commit 7b5a5f5682
24 changed files with 283 additions and 59 deletions
@@ -18,8 +18,8 @@ fun Boolean?.case_1(): Boolean {
// TESTCASE NUMBER: 2
fun <T : <!FINAL_UPPER_BOUND!>Boolean<!>>T?.case_2(): Boolean {
<!ERROR_IN_CONTRACT_DESCRIPTION!>contract<!> { returns(true) implies (this@case_2 != null && this@case_2 !is Nothing && <!DEBUG_INFO_SMARTCAST!>this@case_2<!>) }
return this != null && this !is Nothing && <!DEBUG_INFO_SMARTCAST!>this<!>
<!ERROR_IN_CONTRACT_DESCRIPTION!>contract<!> { returns(true) implies (this@case_2 != null && <!USELESS_IS_CHECK!>this@case_2 !is Nothing<!> && <!DEBUG_INFO_SMARTCAST!>this@case_2<!>) }
return this != null && <!USELESS_IS_CHECK!>this !is Nothing<!> && <!DEBUG_INFO_SMARTCAST!>this<!>
}
// TESTCASE NUMBER: 3