[FIR] Add checker for MISSING_DEPENDENCY_CLASS

#KT-59371 Fixed
This commit is contained in:
Brian Norman
2023-08-21 06:59:13 -05:00
committed by Space Team
parent ecb6b5dc58
commit 833072e1fb
30 changed files with 145 additions and 277 deletions
@@ -247,7 +247,7 @@ fun case_4(value_1: Any?) {
case_4_2(<!ARGUMENT_TYPE_MISMATCH!>value_1<!>)
value_1.toByte()
case_4_3(value_1)
value_1.inv()
value_1.<!MISSING_DEPENDENCY_CLASS!>inv<!>()
}
// TESTCASE NUMBER: 5
@@ -340,28 +340,28 @@ fun case_8(value_1: Any?) {
value_1<!UNNECESSARY_SAFE_CALL!>?.<!><!UNRESOLVED_REFERENCE!>toByte<!>()
if (case_8_2(<!ARGUMENT_TYPE_MISMATCH!>value_1<!>)) {
value_1.toByte()
if (case_8_3(value_1)) value_1.inv()
if (case_8_3(value_1)) value_1.<!MISSING_DEPENDENCY_CLASS!>inv<!>()
}
}
if (!case_8_4(value_1)) {
value_1<!UNNECESSARY_SAFE_CALL!>?.<!><!UNRESOLVED_REFERENCE!>toByte<!>()
if (!case_8_5(<!ARGUMENT_TYPE_MISMATCH!>value_1<!>)) {
value_1.toByte()
if (!case_8_6(value_1)) value_1.inv()
if (!case_8_6(value_1)) value_1.<!MISSING_DEPENDENCY_CLASS!>inv<!>()
}
}
if (case_8_7(value_1) == null) {
value_1?.<!UNRESOLVED_REFERENCE!>toByte<!>()
if (case_8_8(<!ARGUMENT_TYPE_MISMATCH!>value_1<!>) != null) {
value_1<!UNSAFE_CALL!>.<!>toByte()
if (case_8_9(<!ARGUMENT_TYPE_MISMATCH!>value_1<!>) != null) value_1<!UNSAFE_CALL!>.<!>inv()
if (case_8_9(<!ARGUMENT_TYPE_MISMATCH!>value_1<!>) != null) value_1<!UNSAFE_CALL!>.<!><!MISSING_DEPENDENCY_CLASS!>inv<!>()
}
}
if (case_8_10(value_1) != null) {
value_1?.<!UNRESOLVED_REFERENCE!>toByte<!>()
if (case_8_11(<!ARGUMENT_TYPE_MISMATCH!>value_1<!>) == null) {
value_1<!UNSAFE_CALL!>.<!>toByte()
if (case_8_12(<!ARGUMENT_TYPE_MISMATCH!>value_1<!>) == null) value_1<!UNSAFE_CALL!>.<!>inv()
if (case_8_12(<!ARGUMENT_TYPE_MISMATCH!>value_1<!>) == null) value_1<!UNSAFE_CALL!>.<!><!MISSING_DEPENDENCY_CLASS!>inv<!>()
}
}
}
@@ -19,7 +19,7 @@ fun case_1(x: ClassWithCustomEquals) {
val y = null
if (<!SENSELESS_COMPARISON!>x == y<!>) {
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals & kotlin.Nothing")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals & kotlin.Nothing")!>x<!>.inv()
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals & kotlin.Nothing")!>x<!>.<!MISSING_DEPENDENCY_CLASS!>inv<!>()
}
}
@@ -27,7 +27,7 @@ fun case_1(x: ClassWithCustomEquals) {
fun case_2(x: ClassWithCustomEquals) {
if (<!SENSELESS_COMPARISON!>x == null<!>) {
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals & kotlin.Nothing")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals & kotlin.Nothing")!>x<!>.inv()
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals & kotlin.Nothing")!>x<!>.<!MISSING_DEPENDENCY_CLASS!>inv<!>()
}
}
@@ -39,7 +39,7 @@ fun case_2(x: ClassWithCustomEquals) {
fun case_3(x: ClassWithCustomEquals, y: Nothing?) {
if (<!SENSELESS_COMPARISON!>x == y<!>) {
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals & kotlin.Nothing")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals & kotlin.Nothing")!>x<!>.inv()
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals & kotlin.Nothing")!>x<!>.<!MISSING_DEPENDENCY_CLASS!>inv<!>()
}
}
@@ -52,7 +52,7 @@ fun case_4(x: ClassWithCustomEquals) {
val y = null
if (<!SENSELESS_COMPARISON!>y == x<!>) {
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals & kotlin.Nothing")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals & kotlin.Nothing")!>x<!>.inv()
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals & kotlin.Nothing")!>x<!>.<!MISSING_DEPENDENCY_CLASS!>inv<!>()
}
}
@@ -64,7 +64,7 @@ fun case_4(x: ClassWithCustomEquals) {
fun case_5(x: ClassWithCustomEquals, y: Nothing?) {
if (<!SENSELESS_COMPARISON!>y == x<!>) {
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals & kotlin.Nothing")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals & kotlin.Nothing")!>x<!>.inv()
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals & kotlin.Nothing")!>x<!>.<!MISSING_DEPENDENCY_CLASS!>inv<!>()
}
}
@@ -77,7 +77,7 @@ fun case_6(x: ClassWithCustomEquals) {
val y = null
if (<!SENSELESS_COMPARISON!>x == y<!> == true) {
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals & kotlin.Nothing")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals & kotlin.Nothing")!>x<!>.inv()
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals & kotlin.Nothing")!>x<!>.<!MISSING_DEPENDENCY_CLASS!>inv<!>()
}
}
@@ -85,7 +85,7 @@ fun case_6(x: ClassWithCustomEquals) {
fun case_7(x: ClassWithCustomEquals) {
if ((<!SENSELESS_COMPARISON!>x != null<!>) == false) {
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals & kotlin.Nothing")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals & kotlin.Nothing")!>x<!>.inv()
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals & kotlin.Nothing")!>x<!>.<!MISSING_DEPENDENCY_CLASS!>inv<!>()
}
}
@@ -97,7 +97,7 @@ fun case_7(x: ClassWithCustomEquals) {
fun case_8(x: ClassWithCustomEquals, y: Nothing?) {
if (!(<!SENSELESS_COMPARISON!>y == x<!>) == false) {
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals & kotlin.Nothing")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals & kotlin.Nothing")!>x<!>.inv()
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals & kotlin.Nothing")!>x<!>.<!MISSING_DEPENDENCY_CLASS!>inv<!>()
}
}
@@ -13,7 +13,7 @@
fun case_1(x: Any?) {
if (x is Nothing) {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Nothing")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Nothing")!>x<!>.inv()
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Nothing")!>x<!>.<!MISSING_DEPENDENCY_CLASS!>inv<!>()
}
}
@@ -21,7 +21,7 @@ fun case_1(x: Any?) {
fun case_2(x: Any) {
if (x is Nothing) {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any & kotlin.Nothing")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any & kotlin.Nothing")!>x<!>.inv()
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any & kotlin.Nothing")!>x<!>.<!MISSING_DEPENDENCY_CLASS!>inv<!>()
}
}
@@ -29,7 +29,7 @@ fun case_2(x: Any) {
fun case_3(x: Any?) {
if (x !is Nothing) else {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Nothing")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Nothing")!>x<!>.inv()
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Nothing")!>x<!>.<!MISSING_DEPENDENCY_CLASS!>inv<!>()
}
}
@@ -37,7 +37,7 @@ fun case_3(x: Any?) {
fun case_4(x: Any) {
if (x !is Nothing) else {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any & kotlin.Nothing")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any & kotlin.Nothing")!>x<!>.inv()
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any & kotlin.Nothing")!>x<!>.<!MISSING_DEPENDENCY_CLASS!>inv<!>()
}
}
@@ -53,7 +53,7 @@ fun case_5(x: Any?) {
fun case_6(x: Any?) {
if (!(x !is Nothing)) {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Nothing")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Nothing")!>x<!>.inv()
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Nothing")!>x<!>.<!MISSING_DEPENDENCY_CLASS!>inv<!>()
}
}
@@ -61,7 +61,7 @@ fun case_6(x: Any?) {
fun case_7(x: Any) {
if (!(x is Nothing)) else {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any & kotlin.Nothing")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any & kotlin.Nothing")!>x<!>.inv()
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any & kotlin.Nothing")!>x<!>.<!MISSING_DEPENDENCY_CLASS!>inv<!>()
}
}
@@ -85,7 +85,7 @@ fun case_9(x: Any?) {
fun case_10(x: Any?) {
if (!!(x !is Nothing)) else {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Nothing")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Nothing")!>x<!>.inv()
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Nothing")!>x<!>.<!MISSING_DEPENDENCY_CLASS!>inv<!>()
}
}
@@ -15,7 +15,7 @@
fun case_1(x: Nothing?) {
if (x is Int) {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing? & kotlin.Nothing")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing? & kotlin.Nothing")!>x<!>.inv()
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing? & kotlin.Nothing")!>x<!>.<!MISSING_DEPENDENCY_CLASS!>inv<!>()
}
}
@@ -23,7 +23,7 @@ fun case_1(x: Nothing?) {
fun case_2(x: Nothing) {
if (<!USELESS_IS_CHECK!>x is Unit<!>) {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing")!>x<!>.inv()
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing")!>x<!>.<!MISSING_DEPENDENCY_CLASS!>inv<!>()
}
}
@@ -71,7 +71,7 @@ fun case_7(x: Nothing) {
fun case_8(x: Nothing?) {
if (!(<!USELESS_IS_CHECK!>x is Int?<!>)) else {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing?")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing?")!>x<!>?.inv()
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing?")!>x<!>?.<!MISSING_DEPENDENCY_CLASS!>inv<!>()
}
}
@@ -25,7 +25,7 @@ fun case_1(x: Any?) {
fun case_2(x: Any?) {
(x as Nothing?)!!
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Nothing")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Nothing")!>x<!><!UNSAFE_CALL{LT}!>.<!><!UNRESOLVED_REFERENCE{LT}!>inv<!>()
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Nothing")!>x<!>.<!MISSING_DEPENDENCY_CLASS!>inv<!>()
}
// TESTCASE NUMBER: 3
@@ -40,7 +40,7 @@ fun case_3(x: Any?) {
fun case_4(x: Any?) {
if (x as Class? is Class) {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & Class")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & Class")!>x<!><!UNSAFE_CALL{LT}!>.<!>prop_1
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & Class")!>x<!>.prop_1
}
}
@@ -48,7 +48,7 @@ fun case_4(x: Any?) {
fun case_5(x: Any?) {
if (x as Nothing? is Nothing) {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Nothing")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Nothing")!>x<!><!UNSAFE_CALL{LT}!>.<!><!UNRESOLVED_REFERENCE{LT}!>inv<!>()
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Nothing")!>x<!>.<!MISSING_DEPENDENCY_CLASS!>inv<!>()
}
}
@@ -56,14 +56,14 @@ fun case_5(x: Any?) {
fun case_6(x: Any?) {
(x as String?)!!
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.String")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.String")!>x<!><!UNSAFE_CALL{LT}!>.<!>length
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.String")!>x<!>.length
}
// TESTCASE NUMBER: 7
fun case_7(x: Any?) {
if (x as String? != null) {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.String")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.String")!>x<!><!UNSAFE_CALL{LT}!>.<!>length
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.String")!>x<!>.length
}
}