[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
@@ -13,7 +13,7 @@
// TESTCASE NUMBER: 1
fun case_1(x: Nothing?) {
if (<!DEBUG_INFO_CONSTANT!>x<!> is Int) {
if (<!USELESS_IS_CHECK!><!DEBUG_INFO_CONSTANT!>x<!> is Int<!>) {
<!DEBUG_INFO_CONSTANT, DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing?")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing?"), SMARTCAST_IMPOSSIBLE!>x<!>.inv()
}
@@ -29,7 +29,7 @@ fun case_2(x: Nothing) {
// TESTCASE NUMBER: 3
fun case_3(x: Nothing?) {
if (<!DEBUG_INFO_CONSTANT!>x<!> !is Class) else {
if (<!USELESS_IS_CHECK!><!DEBUG_INFO_CONSTANT!>x<!> !is Class<!>) else {
<!DEBUG_INFO_CONSTANT, DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing?")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing?"), SMARTCAST_IMPOSSIBLE!>x<!>.prop_1
}
@@ -53,7 +53,7 @@ fun case_5(x: Nothing?) {
// TESTCASE NUMBER: 6
fun case_6(x: Nothing?) {
if (!(<!DEBUG_INFO_CONSTANT!>x<!> !is Object)) {
if (!(<!USELESS_IS_CHECK!><!DEBUG_INFO_CONSTANT!>x<!> !is Object<!>)) {
<!DEBUG_INFO_CONSTANT, DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing?")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing?"), SMARTCAST_IMPOSSIBLE!>x<!>.prop_1
}
@@ -85,7 +85,7 @@ fun case_9(x: Nothing?) {
// TESTCASE NUMBER: 10
fun case_10(x: Nothing?) {
if (!!(<!DEBUG_INFO_CONSTANT!>x<!> !is Interface3)) else {
if (!!(<!USELESS_IS_CHECK!><!DEBUG_INFO_CONSTANT!>x<!> !is Interface3<!>)) else {
<!DEBUG_INFO_CONSTANT, DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing?")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing?"), SMARTCAST_IMPOSSIBLE!>x<!>.itest()
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing?"), SMARTCAST_IMPOSSIBLE!>x<!>.itest3()