Add quickfix for CONST_VAL_NOT_TOP_LEVEL_OR_OBJECT to remove const modifier
#KT-35215 Fixed
This commit is contained in:
committed by
Yan Zhulanow
parent
5a3c6def8f
commit
668473c337
@@ -599,7 +599,10 @@ class QuickFixRegistrar : QuickFixContributor {
|
||||
|
||||
TYPE_VARIANCE_CONFLICT.registerFactory(RemoveTypeVarianceFix)
|
||||
|
||||
CONST_VAL_NOT_TOP_LEVEL_OR_OBJECT.registerFactory(MoveMemberToCompanionObjectIntention)
|
||||
CONST_VAL_NOT_TOP_LEVEL_OR_OBJECT.registerFactory(
|
||||
MoveMemberToCompanionObjectIntention,
|
||||
RemoveModifierFix.createRemoveModifierFactory()
|
||||
)
|
||||
|
||||
NO_COMPANION_OBJECT.registerFactory(AddIsToWhenConditionFix)
|
||||
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
// "Remove 'const' modifier" "true"
|
||||
class Foo {
|
||||
<caret>const val s = "s"
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
// "Remove 'const' modifier" "true"
|
||||
class Foo {
|
||||
val s = "s"
|
||||
}
|
||||
+13
@@ -3712,6 +3712,19 @@ public class QuickFixMultiFileTestGenerated extends AbstractQuickFixMultiFileTes
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/quickfix/redundantConst")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class RedundantConst extends AbstractQuickFixMultiFileTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTestWithExtraFile, this, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInRedundantConst() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/testData/quickfix/redundantConst"), Pattern.compile("^(\\w+)\\.((before\\.Main\\.\\w+)|(test))$"), null, true);
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/quickfix/redundantFun")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
@@ -10667,6 +10667,24 @@ public class QuickFixTestGenerated extends AbstractQuickFixTest {
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/quickfix/redundantConst")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class RedundantConst extends AbstractQuickFixTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInRedundantConst() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/testData/quickfix/redundantConst"), Pattern.compile("^([\\w\\-_]+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@TestMetadata("simple.kt")
|
||||
public void testSimple() throws Exception {
|
||||
runTest("idea/testData/quickfix/redundantConst/simple.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/quickfix/redundantFun")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
Reference in New Issue
Block a user