RemoveModifierFix: fix message for 'companion object'
#KT-35604 Fixed
This commit is contained in:
committed by
Mikhail Glukhikh
parent
3dc58bc995
commit
716036a000
@@ -95,6 +95,8 @@ open class AddModifierFix(
|
||||
val nameIdentifier = modifierListOwner.nameIdentifier
|
||||
if (nameIdentifier != null) {
|
||||
name = nameIdentifier.text
|
||||
} else if ((modifierListOwner as? KtObjectDeclaration)?.isCompanion() == true) {
|
||||
name = "companion object"
|
||||
}
|
||||
} else if (modifierListOwner is KtPropertyAccessor) {
|
||||
name = modifierListOwner.namePlaceholder.text
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
// "Make 'companion object' not open" "true"
|
||||
class A {
|
||||
<caret>open companion object {
|
||||
fun a(): Int = 1
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
// "Make 'companion object' not open" "true"
|
||||
class A {
|
||||
companion object {
|
||||
fun a(): Int = 1
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
// "Make 'Foo' not open" "true"
|
||||
class A {
|
||||
<caret>open companion object Foo {
|
||||
fun a(): Int = 1
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
// "Make 'Foo' not open" "true"
|
||||
class A {
|
||||
companion object Foo {
|
||||
fun a(): Int = 1
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
// "Make 'Foo' not open" "true"
|
||||
<caret>open object Foo {
|
||||
fun a(): Int = 1
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
// "Make 'Foo' not open" "true"
|
||||
object Foo {
|
||||
fun a(): Int = 1
|
||||
}
|
||||
@@ -8914,6 +8914,16 @@ public class QuickFixTestGenerated extends AbstractQuickFixTest {
|
||||
runTest("idea/testData/quickfix/modifiers/notAnAnnotationClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("openCompanionObject.kt")
|
||||
public void testOpenCompanionObject() throws Exception {
|
||||
runTest("idea/testData/quickfix/modifiers/openCompanionObject.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("openCompanionObject2.kt")
|
||||
public void testOpenCompanionObject2() throws Exception {
|
||||
runTest("idea/testData/quickfix/modifiers/openCompanionObject2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("openMemberInFinalClass1.kt")
|
||||
public void testOpenMemberInFinalClass1() throws Exception {
|
||||
runTest("idea/testData/quickfix/modifiers/openMemberInFinalClass1.kt");
|
||||
@@ -8939,6 +8949,11 @@ public class QuickFixTestGenerated extends AbstractQuickFixTest {
|
||||
runTest("idea/testData/quickfix/modifiers/openModifierInEnum.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("openObject.kt")
|
||||
public void testOpenObject() throws Exception {
|
||||
runTest("idea/testData/quickfix/modifiers/openObject.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("openVarWithPrivateSetter.kt")
|
||||
public void testOpenVarWithPrivateSetter() throws Exception {
|
||||
runTest("idea/testData/quickfix/modifiers/openVarWithPrivateSetter.kt");
|
||||
|
||||
Reference in New Issue
Block a user