Added quickfix for VAR_OVERRIDDEN_BY_VAL.

This commit is contained in:
Jack Zhou
2013-02-09 00:48:25 -05:00
committed by Andrey Breslav
parent 7231606eb2
commit a5cecd6048
4 changed files with 22 additions and 0 deletions
@@ -144,6 +144,7 @@ public class QuickFixes {
ChangeVariableMutabilityFix changeVariableMutabilityFix = new ChangeVariableMutabilityFix();
actions.put(VAL_WITH_SETTER, changeVariableMutabilityFix);
actions.put(VAL_REASSIGNMENT, changeVariableMutabilityFix);
actions.put(VAR_OVERRIDDEN_BY_VAL, changeVariableMutabilityFix);
actions.put(UNNECESSARY_SAFE_CALL, ReplaceCallFix.toDotCallFromSafeCall());
actions.put(UNSAFE_CALL, ReplaceCallFix.toSafeCall());
@@ -0,0 +1,8 @@
// "Make variable mutable" "true"
open class A {
open var x = 42;
}
class B : A() {
override var x: Int = 3;
}
@@ -0,0 +1,8 @@
// "Make variable mutable" "true"
open class A {
open var x = 42;
}
class B : A() {
override val<caret> x: Int = 3;
}
@@ -746,6 +746,11 @@ public class QuickFixTestGenerated extends AbstractQuickFixTest {
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("idea/testData/quickfix/variables/changeMutability"), Pattern.compile("^before(\\w+)\\.kt$"), true);
}
@TestMetadata("beforeValOverrideVar.kt")
public void testValOverrideVar() throws Exception {
doTest("idea/testData/quickfix/variables/changeMutability/beforeValOverrideVar.kt");
}
@TestMetadata("beforeValReassignmentLocal.kt")
public void testValReassignmentLocal() throws Exception {
doTest("idea/testData/quickfix/variables/changeMutability/beforeValReassignmentLocal.kt");