Old backing field with dollar is now forbidden
This commit is contained in:
+1
-1
@@ -36,7 +36,7 @@ public class KotlinHistoryHighlighter(private val runner: KotlinConsoleRunner )
|
||||
else
|
||||
runner.changeConsoleEditorIndicator(ReplIcons.EDITOR_INDICATOR)
|
||||
|
||||
$isReadLineMode = value
|
||||
field = value
|
||||
}
|
||||
|
||||
fun printNewCommandInHistory(trimmedCommandText: String) {
|
||||
|
||||
@@ -90,7 +90,7 @@ public class KotlinCleanupInspection(): LocalInspectionTool(), CleanupLocalInspe
|
||||
ErrorsJvm.POSITIONED_VALUE_ARGUMENT_FOR_JAVA_ANNOTATION,
|
||||
Errors.DEPRECATED_SYMBOL_WITH_MESSAGE,
|
||||
Errors.NON_CONST_VAL_USED_IN_CONSTANT_EXPRESSION,
|
||||
Errors.BACKING_FIELD_SYNTAX_DEPRECATED,
|
||||
Errors.BACKING_FIELD_OLD_SYNTAX,
|
||||
Errors.OPERATOR_MODIFIER_REQUIRED,
|
||||
Errors.INFIX_MODIFIER_REQUIRED,
|
||||
Errors.CALLABLE_REFERENCE_TO_MEMBER_OR_EXTENSION_WITH_EMPTY_LHS,
|
||||
|
||||
@@ -324,9 +324,9 @@ public class QuickFixRegistrar : QuickFixContributor {
|
||||
|
||||
NON_CONST_VAL_USED_IN_CONSTANT_EXPRESSION.registerFactory(ConstFixFactory)
|
||||
|
||||
BACKING_FIELD_SYNTAX_DEPRECATED.registerFactory(MigrateBackingFieldSyntaxFix)
|
||||
BACKING_FIELD_USAGE_DEPRECATED.registerFactory(MigrateBackingFieldUsageFix)
|
||||
BACKING_FIELD_USAGE_DEPRECATED.registerFactory(IntroduceBackingPropertyFix)
|
||||
BACKING_FIELD_OLD_SYNTAX.registerFactory(MigrateBackingFieldSyntaxFix)
|
||||
BACKING_FIELD_USAGE_FORBIDDEN.registerFactory(MigrateBackingFieldUsageFix)
|
||||
BACKING_FIELD_USAGE_FORBIDDEN.registerFactory(IntroduceBackingPropertyFix)
|
||||
|
||||
OPERATOR_MODIFIER_REQUIRED.registerFactory(ModifierFixFactory(JetTokens.OPERATOR_KEYWORD))
|
||||
INFIX_MODIFIER_REQUIRED.registerFactory(ModifierFixFactory(JetTokens.INFIX_KEYWORD))
|
||||
|
||||
@@ -66,7 +66,7 @@ public open class JetChangeInfo(
|
||||
if (value != null && value !in newParameters) {
|
||||
newParameters.add(value)
|
||||
}
|
||||
$receiverParameterInfo = value
|
||||
field = value
|
||||
}
|
||||
|
||||
private val newParameters = parameterInfos.toArrayList()
|
||||
@@ -155,7 +155,7 @@ public open class JetChangeInfo(
|
||||
|
||||
public var primaryPropagationTargets: Collection<PsiElement> = emptyList()
|
||||
set(value: Collection<PsiElement>) {
|
||||
$primaryPropagationTargets = value
|
||||
field = value
|
||||
|
||||
val result = LinkedHashSet<UsageInfo>()
|
||||
|
||||
|
||||
+1
-1
@@ -52,7 +52,7 @@ public class JetChangeSignatureData(
|
||||
override val receiver: JetParameterInfo?
|
||||
|
||||
init {
|
||||
$receiver = createReceiverInfoIfNeeded()
|
||||
receiver = createReceiverInfoIfNeeded()
|
||||
|
||||
val valueParameters = when {
|
||||
baseDeclaration is JetFunction -> baseDeclaration.getValueParameters()
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ public class JetMutableMethodDescriptor(override val original: JetMethodDescript
|
||||
if (value != null && value !in parameters) {
|
||||
parameters.add(value)
|
||||
}
|
||||
$receiver = value
|
||||
field = value
|
||||
}
|
||||
|
||||
public fun addParameter(parameter: JetParameterInfo) {
|
||||
|
||||
+2
-2
@@ -101,7 +101,7 @@ public class KotlinInplaceParameterIntroducer(
|
||||
var addedRange: TextRange? = null
|
||||
private set
|
||||
|
||||
var text: String
|
||||
var text: String = ""
|
||||
private set
|
||||
|
||||
val rangesToRemove: List<TextRange> get() = _rangesToRemove
|
||||
@@ -163,7 +163,7 @@ public class KotlinInplaceParameterIntroducer(
|
||||
}
|
||||
}
|
||||
|
||||
$text = builder.toString()
|
||||
text = builder.toString()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -62,7 +62,7 @@ public class KotlinInplacePropertyIntroducer(
|
||||
set(value: ExtractionTarget) {
|
||||
if (value == currentTarget) return
|
||||
|
||||
$currentTarget = value
|
||||
field = value
|
||||
runWriteActionAndRestartRefactoring {
|
||||
with (extractionResult.config) {
|
||||
extractionResult = copy(generatorOptions = generatorOptions.copy(target = currentTarget)).generateDeclaration(property)
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@ interface NoC {
|
||||
class WithC() {
|
||||
val x : Int
|
||||
init {
|
||||
<warning descr="[BACKING_FIELD_USAGE_DEPRECATED] Backing field usage is deprecated here, soon it will be possible only in property accessors">$x</warning> = 1
|
||||
<error>$x</error> = 1
|
||||
<error>$y</error> = 2
|
||||
val <warning>b</warning> = x
|
||||
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@ class WithCPI_Dup(<warning>x</warning> : Int) {
|
||||
|
||||
class WithCPI(x : Int) {
|
||||
val a = 1
|
||||
val b : Int = <warning descr="[BACKING_FIELD_USAGE_DEPRECATED] Backing field usage is deprecated here, soon it will be possible only in property accessors">$a</warning>
|
||||
val b : Int = <error>$a</error>
|
||||
val xy : Int = x
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -2,5 +2,5 @@
|
||||
|
||||
class WithC() {
|
||||
val a = 1
|
||||
val b = <warning descr="[BACKING_FIELD_USAGE_DEPRECATED] Backing field usage is deprecated here, soon it will be possible only in property accessors">$a</warning> // error here, but must not be
|
||||
val b = <error>$a</error> // error here, but must not be
|
||||
}
|
||||
@@ -22,7 +22,7 @@ class A {
|
||||
return 1
|
||||
}
|
||||
set(i: Int) {
|
||||
$prop = i
|
||||
field = i
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ val <info textAttributesKey="KOTLIN_CLASS">Int</info>.<info textAttributesKey="K
|
||||
|
||||
val <info textAttributesKey="KOTLIN_PACKAGE_PROPERTY"><info textAttributesKey="KOTLIN_PROPERTY_WITH_BACKING_FIELD">y</info></info> : <info textAttributesKey="KOTLIN_CLASS">Int</info> = 1
|
||||
<info textAttributesKey="KOTLIN_KEYWORD">get</info>() {
|
||||
return 5.<info textAttributesKey="KOTLIN_EXTENSION_PROPERTY"><info textAttributesKey="KOTLIN_PACKAGE_PROPERTY">sq</info></info> + <info textAttributesKey="KOTLIN_PACKAGE_PROPERTY"><info textAttributesKey="KOTLIN_BACKING_FIELD_ACCESS">$y</info></info> + <info textAttributesKey="KOTLIN_MUTABLE_VARIABLE"><info textAttributesKey="KOTLIN_PACKAGE_PROPERTY">x</info></info>
|
||||
return 5.<info textAttributesKey="KOTLIN_EXTENSION_PROPERTY"><info textAttributesKey="KOTLIN_PACKAGE_PROPERTY">sq</info></info> + <info textAttributesKey="KOTLIN_LOCAL_VARIABLE"><info textAttributesKey="KOTLIN_BACKING_FIELD_VARIABLE">field</info></info> + <info textAttributesKey="KOTLIN_PACKAGE_PROPERTY"><info textAttributesKey="KOTLIN_MUTABLE_VARIABLE">x</info></info>
|
||||
}
|
||||
|
||||
class <info textAttributesKey="KOTLIN_CLASS">Foo</info>(val <info textAttributesKey="KOTLIN_PARAMETER"><info textAttributesKey="KOTLIN_INSTANCE_PROPERTY"><info textAttributesKey="KOTLIN_PROPERTY_WITH_BACKING_FIELD">a</info></info></info> : <info textAttributesKey="KOTLIN_CLASS">Int</info>, <info textAttributesKey="KOTLIN_PARAMETER">b</info> : <info textAttributesKey="KOTLIN_CLASS">String</info>) {
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
class Foo {
|
||||
var <caret>x = ""
|
||||
get() = $x + "!"
|
||||
set(value) { $x = value + "!" }
|
||||
|
||||
fun foo(): String {
|
||||
return $x
|
||||
}
|
||||
get() = field + "!"
|
||||
set(value) { field = value + "!" }
|
||||
}
|
||||
|
||||
@@ -3,8 +3,4 @@ class Foo {
|
||||
var x: String
|
||||
get() = _x + "!"
|
||||
set(value) { _x = value + "!" }
|
||||
|
||||
fun foo(): String {
|
||||
return _x
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
class A {
|
||||
var a: Int
|
||||
var b: Int
|
||||
|
||||
init {
|
||||
<caret>$a = 1
|
||||
b = 2
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
class A {
|
||||
var a: Int =<caret> 1
|
||||
var b: Int
|
||||
|
||||
init {
|
||||
b = 2
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
// "Make 'i' not abstract" "true"
|
||||
class B {
|
||||
<caret>abstract val i: Int = 0
|
||||
get() = $i
|
||||
get() = field
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
// "Make 'i' not abstract" "true"
|
||||
class B {
|
||||
val i: Int = 0
|
||||
get() = $i
|
||||
get() = field
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
class Exp(p1: String) {
|
||||
val /*rename*/prop11: String = p1
|
||||
get(): String {
|
||||
return $prop11
|
||||
return field
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
class Exp(p1: String) {
|
||||
val /*rename*/prop1: String = p1
|
||||
get(): String {
|
||||
return $prop1
|
||||
return field
|
||||
}
|
||||
}
|
||||
@@ -5493,12 +5493,6 @@ public class IntentionTestGenerated extends AbstractIntentionTest {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/intentions/moveAssignmentToInitializer"), Pattern.compile("^([\\w\\-_]+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("backingField.kt")
|
||||
public void testBackingField() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/intentions/moveAssignmentToInitializer/backingField.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("comment.kt")
|
||||
public void testComment() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/intentions/moveAssignmentToInitializer/comment.kt");
|
||||
|
||||
Reference in New Issue
Block a user