"Redundant qualifier name": add tests for enum/object

Relates to #KT-34113
Relates to #KT-32965
Relates to #KT-33991
Relates to #KT-33597
This commit is contained in:
Toshiaki Kameyama
2019-10-04 16:11:17 +09:00
committed by Dmitry Gridin
parent 866ab51ce5
commit a4f805ccd0
15 changed files with 211 additions and 0 deletions
@@ -0,0 +1,12 @@
// WITH_RUNTIME
import Encoding.MJPEG
class Player {
val status: String = <caret>Encoding.MJPEG.toString()
}
enum class Encoding {
UNKNOWN,
MJPEG,
H264
}
@@ -0,0 +1,12 @@
// WITH_RUNTIME
import Encoding.MJPEG
class Player {
val status: String = MJPEG.toString()
}
enum class Encoding {
UNKNOWN,
MJPEG,
H264
}
@@ -0,0 +1,8 @@
// WITH_RUNTIME
enum class B() {
;
fun test() {
<caret>B.values()
}
}
@@ -0,0 +1,8 @@
// WITH_RUNTIME
enum class B() {
;
fun test() {
values()
}
}
@@ -0,0 +1,4 @@
// WITH_RUNTIME
enum class B(val x: Int) {
BB(<caret>B.values().size)
}
@@ -0,0 +1,4 @@
// WITH_RUNTIME
enum class B(val x: Int) {
BB(values().size)
}
@@ -0,0 +1,11 @@
// PROBLEM: none
// WITH_RUNTIME
class Player {
val status: String = <caret>Encoding.MJPEG.toString()
}
enum class Encoding {
UNKNOWN,
MJPEG,
H264
}
@@ -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")
<caret>A.foo()
}
};
abstract fun foo()
}
@@ -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")
<caret>B.foo()
}
};
abstract fun foo()
}
@@ -0,0 +1,11 @@
// PROBLEM: none
// WITH_RUNTIME
enum class A
enum class B() {
;
fun test() {
<caret>A.values()
}
}
@@ -0,0 +1,7 @@
// PROBLEM: none
// WITH_RUNTIME
enum class A
enum class B(val x: Int) {
BB(<caret>A.values().size)
}
@@ -0,0 +1,9 @@
// PROBLEM: none
// WITH_RUNTIME
class Foo {
val prop = <caret>Obj.prop.toString()
}
object Obj {
val prop = "Hello"
}
@@ -0,0 +1,17 @@
// PROBLEM: none
// WITH_RUNTIME
class A {
companion object {
val INST = A()
}
}
class B {
companion object {
val INST = B()
}
fun foo() {
<caret>A.INST.toString()
}
}
@@ -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() = <caret>B.prop.toString()
})
@@ -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");