diff --git a/idea/testData/inspectionsLocal/removeRedundantQualifierName/enumEntry.kt b/idea/testData/inspectionsLocal/removeRedundantQualifierName/enumEntry.kt new file mode 100644 index 00000000000..68df250d78e --- /dev/null +++ b/idea/testData/inspectionsLocal/removeRedundantQualifierName/enumEntry.kt @@ -0,0 +1,12 @@ +// WITH_RUNTIME +import Encoding.MJPEG + +class Player { + val status: String = Encoding.MJPEG.toString() +} + +enum class Encoding { + UNKNOWN, + MJPEG, + H264 +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/removeRedundantQualifierName/enumEntry.kt.after b/idea/testData/inspectionsLocal/removeRedundantQualifierName/enumEntry.kt.after new file mode 100644 index 00000000000..bc5946de8e9 --- /dev/null +++ b/idea/testData/inspectionsLocal/removeRedundantQualifierName/enumEntry.kt.after @@ -0,0 +1,12 @@ +// WITH_RUNTIME +import Encoding.MJPEG + +class Player { + val status: String = MJPEG.toString() +} + +enum class Encoding { + UNKNOWN, + MJPEG, + H264 +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/removeRedundantQualifierName/enumInEnum.kt b/idea/testData/inspectionsLocal/removeRedundantQualifierName/enumInEnum.kt new file mode 100644 index 00000000000..70c1e99e4e0 --- /dev/null +++ b/idea/testData/inspectionsLocal/removeRedundantQualifierName/enumInEnum.kt @@ -0,0 +1,8 @@ +// WITH_RUNTIME +enum class B() { + ; + + fun test() { + B.values() + } +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/removeRedundantQualifierName/enumInEnum.kt.after b/idea/testData/inspectionsLocal/removeRedundantQualifierName/enumInEnum.kt.after new file mode 100644 index 00000000000..aae471e88ec --- /dev/null +++ b/idea/testData/inspectionsLocal/removeRedundantQualifierName/enumInEnum.kt.after @@ -0,0 +1,8 @@ +// WITH_RUNTIME +enum class B() { + ; + + fun test() { + values() + } +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/removeRedundantQualifierName/enumInEnum2.kt b/idea/testData/inspectionsLocal/removeRedundantQualifierName/enumInEnum2.kt new file mode 100644 index 00000000000..247e032bae1 --- /dev/null +++ b/idea/testData/inspectionsLocal/removeRedundantQualifierName/enumInEnum2.kt @@ -0,0 +1,4 @@ +// WITH_RUNTIME +enum class B(val x: Int) { + BB(B.values().size) +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/removeRedundantQualifierName/enumInEnum2.kt.after b/idea/testData/inspectionsLocal/removeRedundantQualifierName/enumInEnum2.kt.after new file mode 100644 index 00000000000..e0b2e007af1 --- /dev/null +++ b/idea/testData/inspectionsLocal/removeRedundantQualifierName/enumInEnum2.kt.after @@ -0,0 +1,4 @@ +// WITH_RUNTIME +enum class B(val x: Int) { + BB(values().size) +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/removeRedundantQualifierName/notApplicableEnumEntry.kt b/idea/testData/inspectionsLocal/removeRedundantQualifierName/notApplicableEnumEntry.kt new file mode 100644 index 00000000000..1eac848ce3f --- /dev/null +++ b/idea/testData/inspectionsLocal/removeRedundantQualifierName/notApplicableEnumEntry.kt @@ -0,0 +1,11 @@ +// PROBLEM: none +// WITH_RUNTIME +class Player { + val status: String = Encoding.MJPEG.toString() +} + +enum class Encoding { + UNKNOWN, + MJPEG, + H264 +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/removeRedundantQualifierName/notApplicableEnumEntryInEnumEntry.kt b/idea/testData/inspectionsLocal/removeRedundantQualifierName/notApplicableEnumEntryInEnumEntry.kt new file mode 100644 index 00000000000..f1c7daeedb3 --- /dev/null +++ b/idea/testData/inspectionsLocal/removeRedundantQualifierName/notApplicableEnumEntryInEnumEntry.kt @@ -0,0 +1,21 @@ +// PROBLEM: none +// WITH_RUNTIME +fun main() { + MyEnum.B.foo() +} + +enum class MyEnum { + A { + override fun foo() { + println("A") + } + }, + B { + override fun foo() { + println("B") + A.foo() + } + }; + + abstract fun foo() +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/removeRedundantQualifierName/notApplicableEnumEntryInEnumEntry2.kt b/idea/testData/inspectionsLocal/removeRedundantQualifierName/notApplicableEnumEntryInEnumEntry2.kt new file mode 100644 index 00000000000..b50e6ebbdcc --- /dev/null +++ b/idea/testData/inspectionsLocal/removeRedundantQualifierName/notApplicableEnumEntryInEnumEntry2.kt @@ -0,0 +1,21 @@ +// PROBLEM: none +// WITH_RUNTIME +fun main() { + MyEnum.B.foo() +} + +enum class MyEnum { + A { + override fun foo() { + println("A") + } + }, + B { + override fun foo() { + println("B") + B.foo() + } + }; + + abstract fun foo() +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/removeRedundantQualifierName/notApplicableEnumInEnum.kt b/idea/testData/inspectionsLocal/removeRedundantQualifierName/notApplicableEnumInEnum.kt new file mode 100644 index 00000000000..c0d669d3adb --- /dev/null +++ b/idea/testData/inspectionsLocal/removeRedundantQualifierName/notApplicableEnumInEnum.kt @@ -0,0 +1,11 @@ +// PROBLEM: none +// WITH_RUNTIME +enum class A + +enum class B() { + ; + + fun test() { + A.values() + } +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/removeRedundantQualifierName/notApplicableEnumInEnum2.kt b/idea/testData/inspectionsLocal/removeRedundantQualifierName/notApplicableEnumInEnum2.kt new file mode 100644 index 00000000000..8b519a842cb --- /dev/null +++ b/idea/testData/inspectionsLocal/removeRedundantQualifierName/notApplicableEnumInEnum2.kt @@ -0,0 +1,7 @@ +// PROBLEM: none +// WITH_RUNTIME +enum class A + +enum class B(val x: Int) { + BB(A.values().size) +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/removeRedundantQualifierName/notApplicableObject.kt b/idea/testData/inspectionsLocal/removeRedundantQualifierName/notApplicableObject.kt new file mode 100644 index 00000000000..cdd4789bc06 --- /dev/null +++ b/idea/testData/inspectionsLocal/removeRedundantQualifierName/notApplicableObject.kt @@ -0,0 +1,9 @@ +// PROBLEM: none +// WITH_RUNTIME +class Foo { + val prop = Obj.prop.toString() +} + +object Obj { + val prop = "Hello" +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/removeRedundantQualifierName/notApplicableObject2.kt b/idea/testData/inspectionsLocal/removeRedundantQualifierName/notApplicableObject2.kt new file mode 100644 index 00000000000..3e0b5801cc8 --- /dev/null +++ b/idea/testData/inspectionsLocal/removeRedundantQualifierName/notApplicableObject2.kt @@ -0,0 +1,17 @@ +// PROBLEM: none +// WITH_RUNTIME +class A { + companion object { + val INST = A() + } +} + +class B { + companion object { + val INST = B() + } + + fun foo() { + A.INST.toString() + } +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/removeRedundantQualifierName/notApplicableObject3.kt b/idea/testData/inspectionsLocal/removeRedundantQualifierName/notApplicableObject3.kt new file mode 100644 index 00000000000..166fb2b017c --- /dev/null +++ b/idea/testData/inspectionsLocal/removeRedundantQualifierName/notApplicableObject3.kt @@ -0,0 +1,11 @@ +// PROBLEM: none +// WITH_RUNTIME +open class A(init: A.() -> Unit) { + val prop: String = "" +} + +object B : A({}) + +object C : A({ + fun foo() = B.prop.toString() +}) diff --git a/idea/tests/org/jetbrains/kotlin/idea/inspections/LocalInspectionTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/inspections/LocalInspectionTestGenerated.java index 0a42020fa58..69e76b88d10 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/inspections/LocalInspectionTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/idea/inspections/LocalInspectionTestGenerated.java @@ -8229,6 +8229,21 @@ public class LocalInspectionTestGenerated extends AbstractLocalInspectionTest { runTest("idea/testData/inspectionsLocal/removeRedundantQualifierName/companionWithOuterName.kt"); } + @TestMetadata("enumEntry.kt") + public void testEnumEntry() throws Exception { + runTest("idea/testData/inspectionsLocal/removeRedundantQualifierName/enumEntry.kt"); + } + + @TestMetadata("enumInEnum.kt") + public void testEnumInEnum() throws Exception { + runTest("idea/testData/inspectionsLocal/removeRedundantQualifierName/enumInEnum.kt"); + } + + @TestMetadata("enumInEnum2.kt") + public void testEnumInEnum2() throws Exception { + runTest("idea/testData/inspectionsLocal/removeRedundantQualifierName/enumInEnum2.kt"); + } + @TestMetadata("expression.kt") public void testExpression() throws Exception { runTest("idea/testData/inspectionsLocal/removeRedundantQualifierName/expression.kt"); @@ -8344,6 +8359,31 @@ public class LocalInspectionTestGenerated extends AbstractLocalInspectionTest { runTest("idea/testData/inspectionsLocal/removeRedundantQualifierName/notApplicableCompanionType2.kt"); } + @TestMetadata("notApplicableEnumEntry.kt") + public void testNotApplicableEnumEntry() throws Exception { + runTest("idea/testData/inspectionsLocal/removeRedundantQualifierName/notApplicableEnumEntry.kt"); + } + + @TestMetadata("notApplicableEnumEntryInEnumEntry.kt") + public void testNotApplicableEnumEntryInEnumEntry() throws Exception { + runTest("idea/testData/inspectionsLocal/removeRedundantQualifierName/notApplicableEnumEntryInEnumEntry.kt"); + } + + @TestMetadata("notApplicableEnumEntryInEnumEntry2.kt") + public void testNotApplicableEnumEntryInEnumEntry2() throws Exception { + runTest("idea/testData/inspectionsLocal/removeRedundantQualifierName/notApplicableEnumEntryInEnumEntry2.kt"); + } + + @TestMetadata("notApplicableEnumInEnum.kt") + public void testNotApplicableEnumInEnum() throws Exception { + runTest("idea/testData/inspectionsLocal/removeRedundantQualifierName/notApplicableEnumInEnum.kt"); + } + + @TestMetadata("notApplicableEnumInEnum2.kt") + public void testNotApplicableEnumInEnum2() throws Exception { + runTest("idea/testData/inspectionsLocal/removeRedundantQualifierName/notApplicableEnumInEnum2.kt"); + } + @TestMetadata("notApplicableExpression.kt") public void testNotApplicableExpression() throws Exception { runTest("idea/testData/inspectionsLocal/removeRedundantQualifierName/notApplicableExpression.kt"); @@ -8379,6 +8419,21 @@ public class LocalInspectionTestGenerated extends AbstractLocalInspectionTest { runTest("idea/testData/inspectionsLocal/removeRedundantQualifierName/notApplicableLocalVariable2.kt"); } + @TestMetadata("notApplicableObject.kt") + public void testNotApplicableObject() throws Exception { + runTest("idea/testData/inspectionsLocal/removeRedundantQualifierName/notApplicableObject.kt"); + } + + @TestMetadata("notApplicableObject2.kt") + public void testNotApplicableObject2() throws Exception { + runTest("idea/testData/inspectionsLocal/removeRedundantQualifierName/notApplicableObject2.kt"); + } + + @TestMetadata("notApplicableObject3.kt") + public void testNotApplicableObject3() throws Exception { + runTest("idea/testData/inspectionsLocal/removeRedundantQualifierName/notApplicableObject3.kt"); + } + @TestMetadata("notApplicableOuterClass.kt") public void testNotApplicableOuterClass() throws Exception { runTest("idea/testData/inspectionsLocal/removeRedundantQualifierName/notApplicableOuterClass.kt");