diff --git a/idea/resources/META-INF/inspections.xml b/idea/resources/META-INF/inspections.xml index 3bfe0cd0a0c..f6ea383e9fa 100644 --- a/idea/resources/META-INF/inspections.xml +++ b/idea/resources/META-INF/inspections.xml @@ -1454,7 +1454,7 @@ 4 light_idea_test_case - Unused equals expression + Unused equals expression Unused equals expression + a == b + 4 + 6 @@ -13,8 +16,11 @@ 5 light_idea_test_case - Unused equals expression + Unused equals expression Unused equals expression + a == 1 + 4 + 6 @@ -22,8 +28,11 @@ 8 light_idea_test_case - Unused equals expression + Unused equals expression Unused equals expression + a == b + 8 + 6 @@ -31,8 +40,11 @@ 13 light_idea_test_case - Unused equals expression + Unused equals expression Unused equals expression + a == b + 8 + 6 @@ -40,8 +52,11 @@ 14 light_idea_test_case - Unused equals expression + Unused equals expression Unused equals expression + a == b + 8 + 6 @@ -49,8 +64,11 @@ 18 light_idea_test_case - Unused equals expression + Unused equals expression Unused equals expression + a == b + 4 + 6 @@ -58,8 +76,11 @@ 38 light_idea_test_case - Unused equals expression + Unused equals expression Unused equals expression + a == 1 + 12 + 6 @@ -67,8 +88,11 @@ 61 light_idea_test_case - Unused equals expression + Unused equals expression Unused equals expression + a == -1 + 28 + 7 @@ -76,8 +100,11 @@ 61 light_idea_test_case - Unused equals expression + Unused equals expression Unused equals expression + a == -1 + 28 + 7 @@ -85,8 +112,11 @@ 71 light_idea_test_case - Unused equals expression + Unused equals expression Unused equals expression + it == null + 34 + 10 @@ -94,8 +124,11 @@ 75 light_idea_test_case - Unused equals expression + Unused equals expression Unused equals expression + it.equals(null) + 34 + 15 @@ -103,7 +136,10 @@ 81 light_idea_test_case - Unused equals expression + Unused equals expression Unused equals expression + equals(null) + 48 + 12 diff --git a/idea/testData/inspectionsLocal/unusedEquals/.inspection b/idea/testData/inspectionsLocal/unusedEquals/.inspection new file mode 100644 index 00000000000..bac2bd40954 --- /dev/null +++ b/idea/testData/inspectionsLocal/unusedEquals/.inspection @@ -0,0 +1 @@ +org.jetbrains.kotlin.idea.inspections.UnusedEqualsInspection \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/unusedEquals/equals.kt b/idea/testData/inspectionsLocal/unusedEquals/equals.kt new file mode 100644 index 00000000000..900b8b2f304 --- /dev/null +++ b/idea/testData/inspectionsLocal/unusedEquals/equals.kt @@ -0,0 +1,4 @@ +// FIX: none +fun foo(a: Int, b: Int) { + a.equals(b) +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/unusedEquals/equals2.kt b/idea/testData/inspectionsLocal/unusedEquals/equals2.kt new file mode 100644 index 00000000000..0e71402f4ba --- /dev/null +++ b/idea/testData/inspectionsLocal/unusedEquals/equals2.kt @@ -0,0 +1,4 @@ +// FIX: none +fun foo(a: Int, b: Int) { + a.equals(b) +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/unusedEquals/simple.kt b/idea/testData/inspectionsLocal/unusedEquals/simple.kt new file mode 100644 index 00000000000..92dafd6be6d --- /dev/null +++ b/idea/testData/inspectionsLocal/unusedEquals/simple.kt @@ -0,0 +1,4 @@ +// FIX: none +fun foo(a: Int, b: Int) { + a == b +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/unusedEquals/simple2.kt b/idea/testData/inspectionsLocal/unusedEquals/simple2.kt new file mode 100644 index 00000000000..b14740287da --- /dev/null +++ b/idea/testData/inspectionsLocal/unusedEquals/simple2.kt @@ -0,0 +1,4 @@ +// FIX: none +fun foo(a: Int, b: Int) { + a == b +} \ No newline at end of file diff --git a/idea/tests/org/jetbrains/kotlin/idea/inspections/LocalInspectionTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/inspections/LocalInspectionTestGenerated.java index afc2a535ed3..1b12bc20d83 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/inspections/LocalInspectionTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/idea/inspections/LocalInspectionTestGenerated.java @@ -13984,6 +13984,39 @@ public class LocalInspectionTestGenerated extends AbstractLocalInspectionTest { } } + @TestMetadata("idea/testData/inspectionsLocal/unusedEquals") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class UnusedEquals extends AbstractLocalInspectionTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInUnusedEquals() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/testData/inspectionsLocal/unusedEquals"), Pattern.compile("^([\\w\\-_]+)\\.(kt|kts)$"), null, true); + } + + @TestMetadata("equals.kt") + public void testEquals() throws Exception { + runTest("idea/testData/inspectionsLocal/unusedEquals/equals.kt"); + } + + @TestMetadata("equals2.kt") + public void testEquals2() throws Exception { + runTest("idea/testData/inspectionsLocal/unusedEquals/equals2.kt"); + } + + @TestMetadata("simple.kt") + public void testSimple() throws Exception { + runTest("idea/testData/inspectionsLocal/unusedEquals/simple.kt"); + } + + @TestMetadata("simple2.kt") + public void testSimple2() throws Exception { + runTest("idea/testData/inspectionsLocal/unusedEquals/simple2.kt"); + } + } + @TestMetadata("idea/testData/inspectionsLocal/unusedLambdaExpressionBody") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class)