FIR checker: warn useless as and is

This commit is contained in:
Jinseong Jeon
2021-04-28 22:32:51 -07:00
committed by TeamCityServer
parent 19d939c36e
commit e2dc21da90
141 changed files with 417 additions and 543 deletions
@@ -12,7 +12,7 @@ fun case_1(x: Any?) {
// TESTCASE NUMBER: 2
fun case_2(x: Any) {
if (x is Number || x !is Number || x is Number) {
if (x is Number || x !is Number || <!USELESS_IS_CHECK!>x is Number<!>) {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any")!>x<!>.<!UNRESOLVED_REFERENCE!>toByte<!>()
}
@@ -20,7 +20,7 @@ fun case_2(x: Any) {
// TESTCASE NUMBER: 3
fun case_3(x: Any?) {
if (x is Boolean || x !is Boolean is Boolean) {
if (x is Boolean || <!USELESS_IS_CHECK!>x !is Boolean is Boolean<!>) {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any?")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any?")!>x<!>.<!UNRESOLVED_REFERENCE!>prop_1<!>
}
@@ -28,7 +28,7 @@ fun case_3(x: Any?) {
// TESTCASE NUMBER: 4
fun case_4(x: Any) {
if (x !is EnumClass || x !is EnumClass || x is EnumClass || x is EnumClass) {
if (x !is EnumClass || <!USELESS_IS_CHECK!>x !is EnumClass<!> || <!USELESS_IS_CHECK!>x is EnumClass<!> || <!USELESS_IS_CHECK!>x is EnumClass<!>) {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any")!>x<!>.<!UNRESOLVED_REFERENCE!>fun_1<!>()
}
@@ -46,7 +46,7 @@ fun case_5(x: Any?) {
// TESTCASE NUMBER: 6
fun case_6(x: Any?) {
if (!(x is Object) || !!(x !is Object)) {
if (!(x is Object) || !!(<!USELESS_IS_CHECK!>x !is Object<!>)) {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any?")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any?")!>x<!>.<!UNRESOLVED_REFERENCE!>prop_1<!>
}
@@ -54,7 +54,7 @@ fun case_6(x: Any?) {
// TESTCASE NUMBER: 7
fun case_7(x: Any) {
if (!(x is DeepObject.A.B.C.D.E.F.G.J) || !!!!!!(x is DeepObject.A.B.C.D.E.F.G.J)) {
if (!(x is DeepObject.A.B.C.D.E.F.G.J) || !!!!!!(<!USELESS_IS_CHECK!>x is DeepObject.A.B.C.D.E.F.G.J<!>)) {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any")!>x<!>.<!UNRESOLVED_REFERENCE!>prop_1<!>
}