From d6988ad69e3b8cf7697791401726faaf5744216b Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Tue, 20 Oct 2015 13:55:37 +0300 Subject: [PATCH] Get rid of FIELD_IDENTIFIER at syntax level, two errors dropped, a set of tests fixed / deleted #KT-9539 Fixed --- .../kotlin/codegen/ExpressionCodegen.java | 4 +- .../cfg/JetFlowInformationProvider.java | 15 +-- .../jetbrains/kotlin/diagnostics/Errors.java | 3 - .../rendering/DefaultErrorMessages.java | 3 - .../kotlin/parsing/JetExpressionParsing.java | 11 +-- .../kotlin/psi/KtNameReferenceExpression.kt | 2 +- .../org/jetbrains/kotlin/psi/KtPsiUtil.java | 8 +- .../kotlin/resolve/BodyResolver.java | 14 +-- .../kotlin/resolve/calls/CallResolver.java | 9 +- .../propertyAccessorScope.instructions | 46 ++++----- .../lexicalScopes/propertyAccessorScope.kt | 4 +- .../propertyAccessorScope.values | 26 ++--- .../AnonymousInitializers.instructions | 22 ++--- .../AnonymousInitializers.kt | 4 +- .../AnonymousInitializers.values | 22 ++--- .../local/LocalDeclarations.instructions | 94 +++++++++---------- .../declarations/local/LocalDeclarations.kt | 10 +- .../local/LocalDeclarations.values | 50 +++++----- .../backingFieldAccess.instructions | 23 ----- .../properties/backingFieldAccess.kt | 8 -- .../properties/backingFieldAccess.values | 14 --- ...backingFieldQualifiedWithThis.instructions | 36 ------- .../backingFieldQualifiedWithThis.kt | 4 - .../backingFieldQualifiedWithThis.values | 17 ---- .../tests/AnonymousInitializers.kt | 2 - .../testData/diagnostics/tests/Properties.kt | 14 +-- .../testData/diagnostics/tests/Properties.txt | 1 - .../tests/backingField/CustomGetSet.kt | 5 - .../tests/backingField/CustomGetSet.txt | 1 - .../CyclicReferenceInitializer.kt | 3 - .../CyclicReferenceInitializer.txt | 9 -- ...dNonexistentAbstractPropertyInAnonymous.kt | 7 -- ...NonexistentAbstractPropertyInAnonymous.txt | 9 -- ...adNonexistentAbstractPropertyInFunction.kt | 5 - ...dNonexistentAbstractPropertyInFunction.txt | 10 -- .../ReadNonexistentCustomGetInAnonymous.kt | 8 -- .../ReadNonexistentCustomGetInAnonymous.txt | 9 -- ...onexistentCustomGetInAnotherInitializer.kt | 6 -- ...nexistentCustomGetInAnotherInitializer.txt | 10 -- .../ReadNonexistentDeclaredInHigher.kt | 6 -- .../ReadNonexistentDeclaredInHigher.txt | 10 -- .../ReadNonexistentPropertyInAnonymous.kt | 5 - .../ReadNonexistentPropertyInAnonymous.txt | 8 -- .../WriteNonexistentDeclaredInHigher.kt | 7 -- .../WriteNonexistentDeclaredInHigher.txt | 10 -- .../tests/backingField/kt782packageLevel.kt | 8 +- .../tests/backingField/kt782packageLevel.txt | 3 +- .../tests/backingField/qualifiedWithThis.kt | 4 - .../tests/backingField/qualifiedWithThis.txt | 10 -- .../UninitializedOrReassignedVariables.kt | 4 +- .../UninitializedOrReassignedVariables.txt | 2 +- .../tests/delegatedProperty/backingField.kt | 2 +- .../tests/delegatedProperty/backingField.txt | 2 +- .../checkBackingFieldException.kt | 2 +- .../diagnostics/tests/scopes/kt250.617.10.kt | 2 +- .../psi/examples/priorityqueues/BinaryHeap.kt | 2 +- .../examples/priorityqueues/BinaryHeap.txt | 2 +- .../labels/labelForPropertyInSetter.resolve | 4 +- .../kotlin/cfg/ControlFlowTestGenerated.java | 12 --- .../kotlin/cfg/PseudoValueTestGenerated.java | 12 --- .../checkers/JetDiagnosticsTestGenerated.java | 54 ----------- .../PropertiesHighlightingVisitor.java | 3 - .../idea/references/KtSimpleNameReference.kt | 8 +- .../kotlin/idea/search/KotlinIndexers.kt | 2 +- .../basic/common/CompletionInSetter.kt | 4 +- .../inspections/KotlinCleanupInspection.kt | 1 - .../IntroduceBackingPropertyIntention.kt | 13 --- .../kotlin/idea/quickfix/QuickFixRegistrar.kt | 4 - .../testData/checker/AnonymousInitializers.kt | 5 +- idea/testData/checker/Constructors.kt | 1 - idea/testData/checker/regression/Jet17.kt | 6 -- idea/testData/inspections/cleanup/cleanup.kt | 6 -- .../inspections/cleanup/cleanup.kt.after | 6 -- .../abstract/abstractPropertyWithGetter2.kt | 2 +- .../migration/backingFieldSyntax/accessor.kt | 7 -- .../backingFieldSyntax/accessor.kt.after | 7 -- .../introduceBackingField.kt | 11 --- .../introduceBackingField.kt.after | 12 --- .../migration/backingFieldSyntax/usage.kt | 7 -- .../backingFieldSyntax/usage.kt.after | 7 -- .../changeToPropertyName/abstractProperty.kt | 5 - .../abstractProperty.kt.after | 5 - .../abstractPropertyThis.kt | 5 - .../abstractPropertyThis.kt.after | 5 - .../changeToPropertyName/customAccessors.kt | 7 -- .../customAccessors.kt.after | 7 -- .../inaccessibleBackingField.kt | 5 - .../inaccessibleBackingField.kt.after | 5 - .../inaccessibleBackingFieldQualified.kt | 6 -- ...inaccessibleBackingFieldQualified.kt.after | 6 -- .../rename/simpleNameReference/renameField.kt | 2 +- .../simpleNameReference/renameField.kt.after | 2 +- .../renameFieldIdentifier.kt | 2 +- .../renameFieldIdentifier.kt.after | 2 +- .../checkers/JetPsiCheckerTestGenerated.java | 6 -- .../idea/quickfix/QuickFixTestGenerated.java | 66 ------------- .../reference/ReferenceTranslator.java | 2 +- 97 files changed, 177 insertions(+), 792 deletions(-) delete mode 100644 compiler/testData/cfg/declarations/properties/backingFieldAccess.instructions delete mode 100644 compiler/testData/cfg/declarations/properties/backingFieldAccess.kt delete mode 100644 compiler/testData/cfg/declarations/properties/backingFieldAccess.values delete mode 100644 compiler/testData/cfg/declarations/properties/backingFieldQualifiedWithThis.instructions delete mode 100644 compiler/testData/cfg/declarations/properties/backingFieldQualifiedWithThis.kt delete mode 100644 compiler/testData/cfg/declarations/properties/backingFieldQualifiedWithThis.values delete mode 100644 compiler/testData/diagnostics/tests/backingField/CyclicReferenceInitializer.kt delete mode 100644 compiler/testData/diagnostics/tests/backingField/CyclicReferenceInitializer.txt delete mode 100644 compiler/testData/diagnostics/tests/backingField/ReadNonexistentAbstractPropertyInAnonymous.kt delete mode 100644 compiler/testData/diagnostics/tests/backingField/ReadNonexistentAbstractPropertyInAnonymous.txt delete mode 100644 compiler/testData/diagnostics/tests/backingField/ReadNonexistentAbstractPropertyInFunction.kt delete mode 100644 compiler/testData/diagnostics/tests/backingField/ReadNonexistentAbstractPropertyInFunction.txt delete mode 100644 compiler/testData/diagnostics/tests/backingField/ReadNonexistentCustomGetInAnonymous.kt delete mode 100644 compiler/testData/diagnostics/tests/backingField/ReadNonexistentCustomGetInAnonymous.txt delete mode 100644 compiler/testData/diagnostics/tests/backingField/ReadNonexistentCustomGetInAnotherInitializer.kt delete mode 100644 compiler/testData/diagnostics/tests/backingField/ReadNonexistentCustomGetInAnotherInitializer.txt delete mode 100644 compiler/testData/diagnostics/tests/backingField/ReadNonexistentDeclaredInHigher.kt delete mode 100644 compiler/testData/diagnostics/tests/backingField/ReadNonexistentDeclaredInHigher.txt delete mode 100644 compiler/testData/diagnostics/tests/backingField/ReadNonexistentPropertyInAnonymous.kt delete mode 100644 compiler/testData/diagnostics/tests/backingField/ReadNonexistentPropertyInAnonymous.txt delete mode 100644 compiler/testData/diagnostics/tests/backingField/WriteNonexistentDeclaredInHigher.kt delete mode 100644 compiler/testData/diagnostics/tests/backingField/WriteNonexistentDeclaredInHigher.txt delete mode 100644 compiler/testData/diagnostics/tests/backingField/qualifiedWithThis.kt delete mode 100644 compiler/testData/diagnostics/tests/backingField/qualifiedWithThis.txt delete mode 100644 idea/testData/checker/regression/Jet17.kt delete mode 100644 idea/testData/quickfix/migration/backingFieldSyntax/accessor.kt delete mode 100644 idea/testData/quickfix/migration/backingFieldSyntax/accessor.kt.after delete mode 100644 idea/testData/quickfix/migration/backingFieldSyntax/introduceBackingField.kt delete mode 100644 idea/testData/quickfix/migration/backingFieldSyntax/introduceBackingField.kt.after delete mode 100644 idea/testData/quickfix/migration/backingFieldSyntax/usage.kt delete mode 100644 idea/testData/quickfix/migration/backingFieldSyntax/usage.kt.after delete mode 100644 idea/testData/quickfix/variables/changeToPropertyName/abstractProperty.kt delete mode 100644 idea/testData/quickfix/variables/changeToPropertyName/abstractProperty.kt.after delete mode 100644 idea/testData/quickfix/variables/changeToPropertyName/abstractPropertyThis.kt delete mode 100644 idea/testData/quickfix/variables/changeToPropertyName/abstractPropertyThis.kt.after delete mode 100644 idea/testData/quickfix/variables/changeToPropertyName/customAccessors.kt delete mode 100644 idea/testData/quickfix/variables/changeToPropertyName/customAccessors.kt.after delete mode 100644 idea/testData/quickfix/variables/changeToPropertyName/inaccessibleBackingField.kt delete mode 100644 idea/testData/quickfix/variables/changeToPropertyName/inaccessibleBackingField.kt.after delete mode 100644 idea/testData/quickfix/variables/changeToPropertyName/inaccessibleBackingFieldQualified.kt delete mode 100644 idea/testData/quickfix/variables/changeToPropertyName/inaccessibleBackingFieldQualified.kt.after diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java index 7f2c4f3e471..ab32f294a91 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java @@ -2007,9 +2007,7 @@ public class ExpressionCodegen extends KtVisitor impleme } } - boolean directToField = - (expression.getReferencedNameElementType() == KtTokens.FIELD_IDENTIFIER || isSyntheticField) - && contextKind() != OwnerKind.DEFAULT_IMPLS; + boolean directToField = isSyntheticField && contextKind() != OwnerKind.DEFAULT_IMPLS; KtSuperExpression superExpression = resolvedCall == null ? null : CallResolverUtilKt.getSuperCallExpression(resolvedCall.getCall()); propertyDescriptor = context.accessibleDescriptor(propertyDescriptor, superExpression); diff --git a/compiler/frontend/src/org/jetbrains/kotlin/cfg/JetFlowInformationProvider.java b/compiler/frontend/src/org/jetbrains/kotlin/cfg/JetFlowInformationProvider.java index 6a8e7bba99e..60bf55a6267 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/cfg/JetFlowInformationProvider.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/cfg/JetFlowInformationProvider.java @@ -402,7 +402,7 @@ public class JetFlowInformationProvider { ) { VariableDescriptor variableDescriptor = ctxt.variableDescriptor; PropertyDescriptor propertyDescriptor = SyntheticFieldDescriptorKt.getReferencedProperty(variableDescriptor); - if (KtPsiUtil.isBackingFieldReference(expression, variableDescriptor) && propertyDescriptor != null) { + if (KtPsiUtil.isBackingFieldReference(variableDescriptor) && propertyDescriptor != null) { KtPropertyAccessor accessor = PsiTreeUtil.getParentOfType(expression, KtPropertyAccessor.class); if (accessor != null) { DeclarationDescriptor accessorDescriptor = trace.get(BindingContext.DECLARATION_TO_DESCRIPTOR, accessor); @@ -511,11 +511,8 @@ public class JetFlowInformationProvider { } } if (variable instanceof KtSimpleNameExpression) { - KtSimpleNameExpression simpleNameExpression = (KtSimpleNameExpression) variable; - if (simpleNameExpression.getReferencedNameElementType() != KtTokens.FIELD_IDENTIFIER) { - trace.record(IS_UNINITIALIZED, (PropertyDescriptor) variableDescriptor); - return true; - } + trace.record(IS_UNINITIALIZED, (PropertyDescriptor) variableDescriptor); + return true; } } return false; @@ -551,9 +548,6 @@ public class JetFlowInformationProvider { DeclarationDescriptor containingDeclaration = variableDescriptor.getContainingDeclaration(); if ((containingDeclaration instanceof ClassDescriptor) && DescriptorUtils.isAncestor(containingDeclaration, declarationDescriptor, false)) { - if (element instanceof KtSimpleNameExpression) { - report(Errors.BACKING_FIELD_USAGE_FORBIDDEN.on((KtSimpleNameExpression) element), cxtx); - } return false; } report(Errors.INACCESSIBLE_BACKING_FIELD.on(element), cxtx); @@ -567,9 +561,6 @@ public class JetFlowInformationProvider { boolean reportError ) { error[0] = false; - if (KtPsiUtil.isBackingFieldReference(element, null)) { - return true; - } if (element instanceof KtDotQualifiedExpression && isCorrectBackingFieldReference( ((KtDotQualifiedExpression) element).getSelectorExpression(), ctxt, error, false)) { if (((KtDotQualifiedExpression) element).getReceiverExpression() instanceof KtThisExpression) { diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java index d42f9fe8235..b4376f030f8 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java @@ -361,9 +361,6 @@ public interface Errors { DiagnosticFactory0 PRIVATE_PROPERTY_IN_INTERFACE = DiagnosticFactory0.create(ERROR, PRIVATE_MODIFIER); DiagnosticFactory0 BACKING_FIELD_IN_INTERFACE = DiagnosticFactory0.create(ERROR, DECLARATION_SIGNATURE); - DiagnosticFactory0 BACKING_FIELD_OLD_SYNTAX = DiagnosticFactory0.create(ERROR); - DiagnosticFactory0 BACKING_FIELD_USAGE_FORBIDDEN = DiagnosticFactory0.create(ERROR); - DiagnosticFactory1 INAPPLICABLE_LATEINIT_MODIFIER = DiagnosticFactory1.create(ERROR); DiagnosticFactory2 ABSTRACT_PROPERTY_IN_NON_ABSTRACT_CLASS = DiagnosticFactory2.create(ERROR, ABSTRACT_MODIFIER); diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java index a72e0ca0a59..dc5cbe31ac9 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java @@ -170,9 +170,6 @@ public class DefaultErrorMessages { MAP.put(INACCESSIBLE_BACKING_FIELD, "The backing field is not accessible here"); MAP.put(NOT_PROPERTY_BACKING_FIELD, "The referenced variable is not a property and doesn't have backing field"); - MAP.put(BACKING_FIELD_OLD_SYNTAX, "This backing field syntax is forbidden, use 'field' instead"); - MAP.put(BACKING_FIELD_USAGE_FORBIDDEN, "Backing field usage is forbidden here"); - MAP.put(MIXING_NAMED_AND_POSITIONED_ARGUMENTS, "Mixing named and positioned arguments is not allowed"); MAP.put(ARGUMENT_PASSED_TWICE, "An argument is already passed for this parameter"); MAP.put(NAMED_PARAMETER_NOT_FOUND, "Cannot find a parameter with this name: {0}", ELEMENT_TEXT); diff --git a/compiler/frontend/src/org/jetbrains/kotlin/parsing/JetExpressionParsing.java b/compiler/frontend/src/org/jetbrains/kotlin/parsing/JetExpressionParsing.java index 128c3eadaf0..d9ca0c7f494 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/parsing/JetExpressionParsing.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/parsing/JetExpressionParsing.java @@ -106,7 +106,6 @@ public class JetExpressionParsing extends AbstractJetParsing { DO_KEYWORD, IDENTIFIER, // SimpleName - FIELD_IDENTIFIER, // Field reference PACKAGE_KEYWORD, // for absolute qualified names AT // Just for better recovery and maybe for annotations @@ -679,9 +678,6 @@ public class JetExpressionParsing extends AbstractJetParsing { VAR_KEYWORD, TYPE_ALIAS_KEYWORD)) { parseLocalDeclaration(); } - else if (at(FIELD_IDENTIFIER)) { - parseSimpleNameExpression(); - } else if (at(IDENTIFIER)) { parseSimpleNameExpression(); } @@ -1019,12 +1015,7 @@ public class JetExpressionParsing extends AbstractJetParsing { */ public void parseSimpleNameExpression() { PsiBuilder.Marker simpleName = mark(); - if (at(FIELD_IDENTIFIER)) { - advance(); // - } - else { - expect(IDENTIFIER, "Expecting an identifier"); - } + expect(IDENTIFIER, "Expecting an identifier"); simpleName.done(REFERENCE_EXPRESSION); } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/psi/KtNameReferenceExpression.kt b/compiler/frontend/src/org/jetbrains/kotlin/psi/KtNameReferenceExpression.kt index 2ea47273b90..2fb7d9e9894 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/psi/KtNameReferenceExpression.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/psi/KtNameReferenceExpression.kt @@ -64,6 +64,6 @@ public class KtNameReferenceExpression : KtExpressionImplStub() { @Override public void handleRecord(WritableSlice slice, KtReferenceExpression expression, DeclarationDescriptor descriptor) { - if (expression instanceof KtSimpleNameExpression) { - KtSimpleNameExpression simpleNameExpression = (KtSimpleNameExpression) expression; - if (simpleNameExpression.getReferencedNameElementType() == KtTokens.FIELD_IDENTIFIER) { - // This check may be considered redundant as long as $x is only accessible from accessors to $x - if (descriptor == propertyDescriptor) { // TODO : original? - trace.record(BindingContext.BACKING_FIELD_REQUIRED, propertyDescriptor); // TODO: this trace? - trace.report(Errors.BACKING_FIELD_OLD_SYNTAX.on(simpleNameExpression)); - } - } - if (descriptor instanceof SyntheticFieldDescriptor) { - trace.record(BindingContext.BACKING_FIELD_REQUIRED, propertyDescriptor); - } + if (expression instanceof KtSimpleNameExpression && descriptor instanceof SyntheticFieldDescriptor) { + trace.record(BindingContext.BACKING_FIELD_REQUIRED, propertyDescriptor); } } }); diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/CallResolver.java b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/CallResolver.java index 2c56064381a..2978b362a2c 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/CallResolver.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/CallResolver.java @@ -141,14 +141,7 @@ public class CallResolver { assert calleeExpression instanceof KtSimpleNameExpression; KtSimpleNameExpression nameExpression = (KtSimpleNameExpression) calleeExpression; Name referencedName = nameExpression.getReferencedNameAsName(); - CallableDescriptorCollectors callableDescriptorCollectors; - if (nameExpression.getReferencedNameElementType() == KtTokens.FIELD_IDENTIFIER) { - referencedName = Name.identifier(referencedName.asString().substring(1)); - callableDescriptorCollectors = CallableDescriptorCollectors.PROPERTIES; - } - else { - callableDescriptorCollectors = CallableDescriptorCollectors.VARIABLES; - } + CallableDescriptorCollectors callableDescriptorCollectors = CallableDescriptorCollectors.VARIABLES; return computeTasksAndResolveCall( context, referencedName, nameExpression, callableDescriptorCollectors, CallTransformer.VARIABLE_CALL_TRANSFORMER); diff --git a/compiler/testData/cfg-variables/lexicalScopes/propertyAccessorScope.instructions b/compiler/testData/cfg-variables/lexicalScopes/propertyAccessorScope.instructions index ef6ac70ae30..371ecbd086c 100644 --- a/compiler/testData/cfg-variables/lexicalScopes/propertyAccessorScope.instructions +++ b/compiler/testData/cfg-variables/lexicalScopes/propertyAccessorScope.instructions @@ -3,52 +3,52 @@ fun foo() { class A { var a : Int get() { - return $a + return field } set(v: Int) { - $a = v + field = v } } } --------------------- L0: - 1 INIT: in: {} out: {} USE: in: {} out: {} - 2 mark({ class A { var a : Int get() { return $a } set(v: Int) { $a = v } } }) - v(var a : Int get() { return $a } set(v: Int) { $a = v }) INIT: in: {} out: {a=D} - jmp?(L2) INIT: in: {a=D} out: {a=D} - d(get() { return $a }) USE: in: {a=READ} out: {a=READ} + 1 INIT: in: {} out: {} + 2 mark({ class A { var a : Int get() { return field } set(v: Int) { field = v } } }) + v(var a : Int get() { return field } set(v: Int) { field = v }) INIT: in: {} out: {a=D} + jmp?(L2) INIT: in: {a=D} out: {a=D} USE: in: {field=ONLY_WRITTEN_NEVER_READ, field=READ} out: {field=ONLY_WRITTEN_NEVER_READ, field=READ} + d(get() { return field }) USE: in: {field=READ} out: {field=READ} L2 [after local declaration]: jmp?(L5) - d(set(v: Int) { $a = v }) USE: in: {a=ONLY_WRITTEN_NEVER_READ} out: {a=ONLY_WRITTEN_NEVER_READ} + d(set(v: Int) { field = v }) USE: in: {field=ONLY_WRITTEN_NEVER_READ} out: {field=ONLY_WRITTEN_NEVER_READ} L1: L5 [after local declaration]: - 1 INIT: in: {} out: {} + 1 INIT: in: {} out: {} error: sink: - USE: in: {} out: {} + USE: in: {} out: {} ===================== == get_a == get() { - return $a + return field } --------------------- L3: - 3 INIT: in: {} out: {} - 4 mark({ return $a }) - magic[IMPLICIT_RECEIVER]($a) -> USE: in: {a=READ} out: {a=READ} - r($a, a|) -> USE: in: {} out: {a=READ} + 3 INIT: in: {} out: {} + 4 mark({ return field }) + magic[IMPLICIT_RECEIVER](field) -> USE: in: {field=READ} out: {field=READ} + r(field|) -> USE: in: {} out: {field=READ} ret(*|) L4 L4: 3 error: sink: - USE: in: {} out: {} + USE: in: {} out: {} ===================== == set_a == set(v: Int) { - $a = v + field = v } --------------------- L6: @@ -56,14 +56,14 @@ L6: v(v: Int) INIT: in: {} out: {v=D} magic[FAKE_INITIALIZER](v: Int) -> INIT: in: {v=D} out: {v=D} w(v|) INIT: in: {v=D} out: {v=ID} - 4 mark({ $a = v }) INIT: in: {v=ID} out: {v=ID} - magic[IMPLICIT_RECEIVER]($a) -> USE: in: {a=ONLY_WRITTEN_NEVER_READ, v=READ} out: {a=ONLY_WRITTEN_NEVER_READ, v=READ} - r(v) -> USE: in: {a=ONLY_WRITTEN_NEVER_READ} out: {a=ONLY_WRITTEN_NEVER_READ, v=READ} - w($a|, ) INIT: in: {v=ID} out: {a=I, v=ID} USE: in: {} out: {a=ONLY_WRITTEN_NEVER_READ} + 4 mark({ field = v }) INIT: in: {v=ID} out: {v=ID} + magic[IMPLICIT_RECEIVER](field) -> USE: in: {field=ONLY_WRITTEN_NEVER_READ, v=READ} out: {field=ONLY_WRITTEN_NEVER_READ, v=READ} + r(v) -> USE: in: {field=ONLY_WRITTEN_NEVER_READ} out: {field=ONLY_WRITTEN_NEVER_READ, v=READ} + w(field|, ) INIT: in: {v=ID} out: {field=I, v=ID} USE: in: {} out: {field=ONLY_WRITTEN_NEVER_READ} L7: - 3 INIT: in: {a=I, v=ID} out: {a=I, v=ID} + 3 INIT: in: {field=I, v=ID} out: {field=I, v=ID} error: INIT: in: {} out: {} sink: - INIT: in: {a=I, v=ID} out: {a=I, v=ID} USE: in: {} out: {} + INIT: in: {field=I, v=ID} out: {field=I, v=ID} USE: in: {} out: {} ===================== \ No newline at end of file diff --git a/compiler/testData/cfg-variables/lexicalScopes/propertyAccessorScope.kt b/compiler/testData/cfg-variables/lexicalScopes/propertyAccessorScope.kt index c8166ade61c..1f3cf918dd2 100644 --- a/compiler/testData/cfg-variables/lexicalScopes/propertyAccessorScope.kt +++ b/compiler/testData/cfg-variables/lexicalScopes/propertyAccessorScope.kt @@ -2,10 +2,10 @@ fun foo() { class A { var a : Int get() { - return $a + return field } set(v: Int) { - $a = v + field = v } } } diff --git a/compiler/testData/cfg-variables/lexicalScopes/propertyAccessorScope.values b/compiler/testData/cfg-variables/lexicalScopes/propertyAccessorScope.values index 7a369d54250..5260759ff37 100644 --- a/compiler/testData/cfg-variables/lexicalScopes/propertyAccessorScope.values +++ b/compiler/testData/cfg-variables/lexicalScopes/propertyAccessorScope.values @@ -3,10 +3,10 @@ fun foo() { class A { var a : Int get() { - return $a + return field } set(v: Int) { - $a = v + field = v } } } @@ -14,22 +14,22 @@ fun foo() { ===================== == get_a == get() { - return $a + return field } --------------------- - : A NEW: magic[IMPLICIT_RECEIVER]($a) -> -$a : Int NEW: r($a, a|) -> -return $a !: * -{ return $a } !: * COPY + : A NEW: magic[IMPLICIT_RECEIVER](field) -> +field : Int NEW: r(field|) -> +return field !: * +{ return field } !: * COPY ===================== == set_a == set(v: Int) { - $a = v + field = v } --------------------- - : Int NEW: magic[FAKE_INITIALIZER](v: Int) -> - : A NEW: magic[IMPLICIT_RECEIVER]($a) -> -v : Int NEW: r(v) -> -$a = v !: * -{ $a = v } !: * COPY + : Int NEW: magic[FAKE_INITIALIZER](v: Int) -> + : A NEW: magic[IMPLICIT_RECEIVER](field) -> +v : Int NEW: r(v) -> +field = v !: * +{ field = v } !: * COPY ===================== diff --git a/compiler/testData/cfg/declarations/classesAndObjects/AnonymousInitializers.instructions b/compiler/testData/cfg/declarations/classesAndObjects/AnonymousInitializers.instructions index 731150fbbd1..06f74dedda9 100644 --- a/compiler/testData/cfg/declarations/classesAndObjects/AnonymousInitializers.instructions +++ b/compiler/testData/cfg/declarations/classesAndObjects/AnonymousInitializers.instructions @@ -4,14 +4,14 @@ class AnonymousInitializers() { val i: Int init { - $i = 12 + i = 12 } val j: Int get() = 20 init { - $i = 13 + i = 13 } } --------------------- @@ -21,19 +21,19 @@ L0: r(34) -> w(k|) v(val i: Int) - 2 mark({ $i = 12 }) - magic[IMPLICIT_RECEIVER]($i) -> + 2 mark({ i = 12 }) + magic[IMPLICIT_RECEIVER](i) -> r(12) -> - w($i|, ) + w(i|, ) 1 v(val j: Int get() = 20) - 2 mark({ $i = 13 }) - magic[IMPLICIT_RECEIVER]($i) -> + 2 mark({ i = 13 }) + magic[IMPLICIT_RECEIVER](i) -> r(13) -> - w($i|, ) + w(i|, ) L1: - 1 NEXT:[] + 1 NEXT:[] error: - PREV:[] + PREV:[] sink: - PREV:[, ] + PREV:[, ] ===================== \ No newline at end of file diff --git a/compiler/testData/cfg/declarations/classesAndObjects/AnonymousInitializers.kt b/compiler/testData/cfg/declarations/classesAndObjects/AnonymousInitializers.kt index 3b7036bf5dd..b9a645571a6 100644 --- a/compiler/testData/cfg/declarations/classesAndObjects/AnonymousInitializers.kt +++ b/compiler/testData/cfg/declarations/classesAndObjects/AnonymousInitializers.kt @@ -3,13 +3,13 @@ class AnonymousInitializers() { val i: Int init { - $i = 12 + i = 12 } val j: Int get() = 20 init { - $i = 13 + i = 13 } } \ No newline at end of file diff --git a/compiler/testData/cfg/declarations/classesAndObjects/AnonymousInitializers.values b/compiler/testData/cfg/declarations/classesAndObjects/AnonymousInitializers.values index e477db295d3..63e2b6d26e3 100644 --- a/compiler/testData/cfg/declarations/classesAndObjects/AnonymousInitializers.values +++ b/compiler/testData/cfg/declarations/classesAndObjects/AnonymousInitializers.values @@ -4,24 +4,24 @@ class AnonymousInitializers() { val i: Int init { - $i = 12 + i = 12 } val j: Int get() = 20 init { - $i = 13 + i = 13 } } --------------------- - : AnonymousInitializers NEW: magic[IMPLICIT_RECEIVER]($i) -> - : AnonymousInitializers NEW: magic[IMPLICIT_RECEIVER]($i) -> -34 : Int NEW: r(34) -> -12 : Int NEW: r(12) -> -$i = 12 !: * -{ $i = 12 } !: * COPY -13 : Int NEW: r(13) -> -$i = 13 !: * -{ $i = 13 } !: * COPY + : AnonymousInitializers NEW: magic[IMPLICIT_RECEIVER](i) -> + : AnonymousInitializers NEW: magic[IMPLICIT_RECEIVER](i) -> +34 : Int NEW: r(34) -> +12 : Int NEW: r(12) -> +i = 12 !: * +{ i = 12 } !: * COPY +13 : Int NEW: r(13) -> +i = 13 !: * +{ i = 13 } !: * COPY ===================== diff --git a/compiler/testData/cfg/declarations/local/LocalDeclarations.instructions b/compiler/testData/cfg/declarations/local/LocalDeclarations.instructions index 77dca2d6b24..f6208404d88 100644 --- a/compiler/testData/cfg/declarations/local/LocalDeclarations.instructions +++ b/compiler/testData/cfg/declarations/local/LocalDeclarations.instructions @@ -6,7 +6,7 @@ class C() { val x : Int init { - $x = 1 + x = 1 } @@ -51,51 +51,51 @@ fun test1() { val a = object { val x : Int init { - $x = 1 + x = 1 } } } --------------------- L0: 1 - 2 mark({ val a = object { val x : Int init { $x = 1 } } }) - v(val a = object { val x : Int init { $x = 1 } }) - mark(object { val x : Int init { $x = 1 } }) + 2 mark({ val a = object { val x : Int init { x = 1 } } }) + v(val a = object { val x : Int init { x = 1 } }) + mark(object { val x : Int init { x = 1 } }) v(val x : Int) - 3 mark({ $x = 1 }) - magic[IMPLICIT_RECEIVER]($x) -> + 3 mark({ x = 1 }) + magic[IMPLICIT_RECEIVER](x) -> r(1) -> - w($x|, ) - 2 r(object { val x : Int init { $x = 1 } }) -> + w(x|, ) + 2 r(object { val x : Int init { x = 1 } }) -> w(a|) L1: - 1 NEXT:[] + 1 NEXT:[] error: - PREV:[] + PREV:[] sink: - PREV:[, ] + PREV:[, ] ===================== == O == object O { val x : Int init { - $x = 1 + x = 1 } } --------------------- L0: 1 v(val x : Int) - 2 mark({ $x = 1 }) - magic[IMPLICIT_RECEIVER]($x) -> + 2 mark({ x = 1 }) + magic[IMPLICIT_RECEIVER](x) -> r(1) -> - w($x|, ) + w(x|, ) L1: - 1 NEXT:[] + 1 NEXT:[] error: - PREV:[] + PREV:[] sink: - PREV:[, ] + PREV:[, ] ===================== == test2 == fun test2() { @@ -177,7 +177,7 @@ fun test4() { val x : Int val y : Int init { - $x = 1 + x = 1 } fun ggg() { y = 10 @@ -187,26 +187,26 @@ fun test4() { --------------------- L0: 1 - 2 mark({ val a = object { val x : Int val y : Int init { $x = 1 } fun ggg() { y = 10 } } }) - v(val a = object { val x : Int val y : Int init { $x = 1 } fun ggg() { y = 10 } }) - mark(object { val x : Int val y : Int init { $x = 1 } fun ggg() { y = 10 } }) + 2 mark({ val a = object { val x : Int val y : Int init { x = 1 } fun ggg() { y = 10 } } }) + v(val a = object { val x : Int val y : Int init { x = 1 } fun ggg() { y = 10 } }) + mark(object { val x : Int val y : Int init { x = 1 } fun ggg() { y = 10 } }) v(val x : Int) v(val y : Int) - 3 mark({ $x = 1 }) - magic[IMPLICIT_RECEIVER]($x) -> + 3 mark({ x = 1 }) + magic[IMPLICIT_RECEIVER](x) -> r(1) -> - w($x|, ) - 2 jmp?(L2) NEXT:[r(object { val x : Int val y : Int init { $x = 1 } fun ggg() { y = 10 } }) -> , d(fun ggg() { y = 10 })] - d(fun ggg() { y = 10 }) NEXT:[] + w(x|, ) + 2 jmp?(L2) NEXT:[r(object { val x : Int val y : Int init { x = 1 } fun ggg() { y = 10 } }) -> , d(fun ggg() { y = 10 })] + d(fun ggg() { y = 10 }) NEXT:[] L2 [after local declaration]: - r(object { val x : Int val y : Int init { $x = 1 } fun ggg() { y = 10 } }) -> PREV:[jmp?(L2)] + r(object { val x : Int val y : Int init { x = 1 } fun ggg() { y = 10 } }) -> PREV:[jmp?(L2)] w(a|) L1: - 1 NEXT:[] + 1 NEXT:[] error: - PREV:[] + PREV:[] sink: - PREV:[, , d(fun ggg() { y = 10 })] + PREV:[, , d(fun ggg() { y = 10 })] ===================== == ggg == fun ggg() { @@ -231,7 +231,7 @@ fun test5() { val a = object { var x = 1 init { - $x = 2 + x = 2 } fun foo() { x = 3 @@ -244,30 +244,30 @@ fun test5() { --------------------- L0: 1 - 2 mark({ val a = object { var x = 1 init { $x = 2 } fun foo() { x = 3 } fun bar() { x = 4 } } }) - v(val a = object { var x = 1 init { $x = 2 } fun foo() { x = 3 } fun bar() { x = 4 } }) - mark(object { var x = 1 init { $x = 2 } fun foo() { x = 3 } fun bar() { x = 4 } }) + 2 mark({ val a = object { var x = 1 init { x = 2 } fun foo() { x = 3 } fun bar() { x = 4 } } }) + v(val a = object { var x = 1 init { x = 2 } fun foo() { x = 3 } fun bar() { x = 4 } }) + mark(object { var x = 1 init { x = 2 } fun foo() { x = 3 } fun bar() { x = 4 } }) v(var x = 1) r(1) -> w(x|) - 3 mark({ $x = 2 }) - magic[IMPLICIT_RECEIVER]($x) -> + 3 mark({ x = 2 }) + magic[IMPLICIT_RECEIVER](x) -> r(2) -> - w($x|, ) - 2 jmp?(L2) NEXT:[jmp?(L5), d(fun foo() { x = 3 })] - d(fun foo() { x = 3 }) NEXT:[] + w(x|, ) + 2 jmp?(L2) NEXT:[jmp?(L5), d(fun foo() { x = 3 })] + d(fun foo() { x = 3 }) NEXT:[] L2 [after local declaration]: - jmp?(L5) NEXT:[r(object { var x = 1 init { $x = 2 } fun foo() { x = 3 } fun bar() { x = 4 } }) -> , d(fun bar() { x = 4 })] PREV:[jmp?(L2)] - d(fun bar() { x = 4 }) NEXT:[] + jmp?(L5) NEXT:[r(object { var x = 1 init { x = 2 } fun foo() { x = 3 } fun bar() { x = 4 } }) -> , d(fun bar() { x = 4 })] PREV:[jmp?(L2)] + d(fun bar() { x = 4 }) NEXT:[] L5 [after local declaration]: - r(object { var x = 1 init { $x = 2 } fun foo() { x = 3 } fun bar() { x = 4 } }) -> PREV:[jmp?(L5)] + r(object { var x = 1 init { x = 2 } fun foo() { x = 3 } fun bar() { x = 4 } }) -> PREV:[jmp?(L5)] w(a|) L1: - 1 NEXT:[] + 1 NEXT:[] error: - PREV:[] + PREV:[] sink: - PREV:[, , d(fun foo() { x = 3 }), d(fun bar() { x = 4 })] + PREV:[, , d(fun foo() { x = 3 }), d(fun bar() { x = 4 })] ===================== == foo == fun foo() { diff --git a/compiler/testData/cfg/declarations/local/LocalDeclarations.kt b/compiler/testData/cfg/declarations/local/LocalDeclarations.kt index bc51d8ae40c..84d2b2a0654 100644 --- a/compiler/testData/cfg/declarations/local/LocalDeclarations.kt +++ b/compiler/testData/cfg/declarations/local/LocalDeclarations.kt @@ -5,7 +5,7 @@ class C() { val x : Int init { - $x = 1 + x = 1 } @@ -22,7 +22,7 @@ fun test1() { val a = object { val x : Int init { - $x = 1 + x = 1 } } } @@ -30,7 +30,7 @@ fun test1() { object O { val x : Int init { - $x = 1 + x = 1 } } @@ -53,7 +53,7 @@ fun test4() { val x : Int val y : Int init { - $x = 1 + x = 1 } fun ggg() { y = 10 @@ -65,7 +65,7 @@ fun test5() { val a = object { var x = 1 init { - $x = 2 + x = 2 } fun foo() { x = 3 diff --git a/compiler/testData/cfg/declarations/local/LocalDeclarations.values b/compiler/testData/cfg/declarations/local/LocalDeclarations.values index a2b655ecff1..66bb0bce620 100644 --- a/compiler/testData/cfg/declarations/local/LocalDeclarations.values +++ b/compiler/testData/cfg/declarations/local/LocalDeclarations.values @@ -6,7 +6,7 @@ class C() { val x : Int init { - $x = 1 + x = 1 } @@ -29,29 +29,29 @@ fun test1() { val a = object { val x : Int init { - $x = 1 + x = 1 } } } --------------------- - : NEW: magic[IMPLICIT_RECEIVER]($x) -> -1 : Int NEW: r(1) -> -$x = 1 !: * -{ $x = 1 } !: * COPY -object { val x : Int init { $x = 1 } } : NEW: r(object { val x : Int init { $x = 1 } }) -> + : NEW: magic[IMPLICIT_RECEIVER](x) -> +1 : Int NEW: r(1) -> +x = 1 !: * +{ x = 1 } !: * COPY +object { val x : Int init { x = 1 } } : NEW: r(object { val x : Int init { x = 1 } }) -> ===================== == O == object O { val x : Int init { - $x = 1 + x = 1 } } --------------------- - : O NEW: magic[IMPLICIT_RECEIVER]($x) -> -1 : Int NEW: r(1) -> -$x = 1 !: * -{ $x = 1 } !: * COPY + : O NEW: magic[IMPLICIT_RECEIVER](x) -> +1 : Int NEW: r(1) -> +x = 1 !: * +{ x = 1 } !: * COPY ===================== == test2 == fun test2() { @@ -93,7 +93,7 @@ fun test4() { val x : Int val y : Int init { - $x = 1 + x = 1 } fun ggg() { y = 10 @@ -101,11 +101,11 @@ fun test4() { } } --------------------- - : NEW: magic[IMPLICIT_RECEIVER]($x) -> -1 : Int NEW: r(1) -> -$x = 1 !: * -{ $x = 1 } !: * COPY -object { val x : Int val y : Int init { $x = 1 } fun ggg() { y = 10 } } : NEW: r(object { val x : Int val y : Int init { $x = 1 } fun ggg() { y = 10 } }) -> + : NEW: magic[IMPLICIT_RECEIVER](x) -> +1 : Int NEW: r(1) -> +x = 1 !: * +{ x = 1 } !: * COPY +object { val x : Int val y : Int init { x = 1 } fun ggg() { y = 10 } } : NEW: r(object { val x : Int val y : Int init { x = 1 } fun ggg() { y = 10 } }) -> ===================== == ggg == fun ggg() { @@ -122,7 +122,7 @@ fun test5() { val a = object { var x = 1 init { - $x = 2 + x = 2 } fun foo() { x = 3 @@ -133,12 +133,12 @@ fun test5() { } } --------------------- - : NEW: magic[IMPLICIT_RECEIVER]($x) -> -1 : Int NEW: r(1) -> -2 : Int NEW: r(2) -> -$x = 2 !: * -{ $x = 2 } !: * COPY -object { var x = 1 init { $x = 2 } fun foo() { x = 3 } fun bar() { x = 4 } } : NEW: r(object { var x = 1 init { $x = 2 } fun foo() { x = 3 } fun bar() { x = 4 } }) -> + : NEW: magic[IMPLICIT_RECEIVER](x) -> +1 : Int NEW: r(1) -> +2 : Int NEW: r(2) -> +x = 2 !: * +{ x = 2 } !: * COPY +object { var x = 1 init { x = 2 } fun foo() { x = 3 } fun bar() { x = 4 } } : NEW: r(object { var x = 1 init { x = 2 } fun foo() { x = 3 } fun bar() { x = 4 } }) -> ===================== == foo == fun foo() { diff --git a/compiler/testData/cfg/declarations/properties/backingFieldAccess.instructions b/compiler/testData/cfg/declarations/properties/backingFieldAccess.instructions deleted file mode 100644 index c8a511376a1..00000000000 --- a/compiler/testData/cfg/declarations/properties/backingFieldAccess.instructions +++ /dev/null @@ -1,23 +0,0 @@ -== C == -class C { - val a: Int - get() = 1 - - init { - $a - } -} ---------------------- -L0: - 1 - v(val a: Int get() = 1) - 2 mark({ $a }) - magic[IMPLICIT_RECEIVER]($a) -> - r($a, a|) -> -L1: - 1 NEXT:[] -error: - PREV:[] -sink: - PREV:[, ] -===================== diff --git a/compiler/testData/cfg/declarations/properties/backingFieldAccess.kt b/compiler/testData/cfg/declarations/properties/backingFieldAccess.kt deleted file mode 100644 index d1a3d87a7a4..00000000000 --- a/compiler/testData/cfg/declarations/properties/backingFieldAccess.kt +++ /dev/null @@ -1,8 +0,0 @@ -class C { - val a: Int - get() = 1 - - init { - $a - } -} \ No newline at end of file diff --git a/compiler/testData/cfg/declarations/properties/backingFieldAccess.values b/compiler/testData/cfg/declarations/properties/backingFieldAccess.values deleted file mode 100644 index 3194299dd53..00000000000 --- a/compiler/testData/cfg/declarations/properties/backingFieldAccess.values +++ /dev/null @@ -1,14 +0,0 @@ -== C == -class C { - val a: Int - get() = 1 - - init { - $a - } -} ---------------------- - : C NEW: magic[IMPLICIT_RECEIVER]($a) -> -$a : * NEW: r($a, a|) -> -{ $a } : * COPY -===================== diff --git a/compiler/testData/cfg/declarations/properties/backingFieldQualifiedWithThis.instructions b/compiler/testData/cfg/declarations/properties/backingFieldQualifiedWithThis.instructions deleted file mode 100644 index 28cce844d5b..00000000000 --- a/compiler/testData/cfg/declarations/properties/backingFieldQualifiedWithThis.instructions +++ /dev/null @@ -1,36 +0,0 @@ -== Bar == -abstract class Bar { - abstract var bar : String - fun foo() = "foo" + this.$bar -} ---------------------- -L0: - 1 - v(abstract var bar : String) -L1: - NEXT:[] -error: - PREV:[] -sink: - PREV:[, ] -===================== -== foo == -fun foo() = "foo" + this.$bar ---------------------- -L0: - 1 - mark("foo") - r("foo") -> - mark(this.$bar) - r(this, ) -> - r($bar, bar|) -> - mark("foo" + this.$bar) - call("foo" + this.$bar, plus|, ) -> - ret(*|) L1 -L1: - NEXT:[] -error: - PREV:[] -sink: - PREV:[, ] -===================== diff --git a/compiler/testData/cfg/declarations/properties/backingFieldQualifiedWithThis.kt b/compiler/testData/cfg/declarations/properties/backingFieldQualifiedWithThis.kt deleted file mode 100644 index cb159cb72d0..00000000000 --- a/compiler/testData/cfg/declarations/properties/backingFieldQualifiedWithThis.kt +++ /dev/null @@ -1,4 +0,0 @@ -abstract class Bar { - abstract var bar : String - fun foo() = "foo" + this.$bar -} \ No newline at end of file diff --git a/compiler/testData/cfg/declarations/properties/backingFieldQualifiedWithThis.values b/compiler/testData/cfg/declarations/properties/backingFieldQualifiedWithThis.values deleted file mode 100644 index 2a8c918a997..00000000000 --- a/compiler/testData/cfg/declarations/properties/backingFieldQualifiedWithThis.values +++ /dev/null @@ -1,17 +0,0 @@ -== Bar == -abstract class Bar { - abstract var bar : String - fun foo() = "foo" + this.$bar -} ---------------------- -===================== -== foo == -fun foo() = "foo" + this.$bar ---------------------- -"foo" : String NEW: r("foo") -> -this : {<: Bar} COPY -this : {<: Bar} NEW: r(this, ) -> -$bar : * NEW: r($bar, bar|) -> -this.$bar : * COPY -"foo" + this.$bar : String NEW: call("foo" + this.$bar, plus|, ) -> -===================== diff --git a/compiler/testData/diagnostics/tests/AnonymousInitializers.kt b/compiler/testData/diagnostics/tests/AnonymousInitializers.kt index 6e5f5164a8a..0d8269ae8fa 100644 --- a/compiler/testData/diagnostics/tests/AnonymousInitializers.kt +++ b/compiler/testData/diagnostics/tests/AnonymousInitializers.kt @@ -13,7 +13,6 @@ interface NoC { class WithC() { val x : Int = 1 init { - $y = 2 val b = x } @@ -23,6 +22,5 @@ class WithC() { init { val z = b val zz = x - val zzz = $a } } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/Properties.kt b/compiler/testData/diagnostics/tests/Properties.kt index c2c86e6d79b..0da9f1cc61b 100644 --- a/compiler/testData/diagnostics/tests/Properties.kt +++ b/compiler/testData/diagnostics/tests/Properties.kt @@ -14,17 +14,9 @@ var x : Int = 1 + x class Test() { var a : Int = 111 - var b : Int get() = $a; set(x) {a = x; $a = x} + var b : Int = 222 + get() = field + set(x) {a = x; field = x} - init { - $b = $a - $a = $b - a = $b - } - - fun f() { - $b = $a - a = $b - } public val i = 1 } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/Properties.txt b/compiler/testData/diagnostics/tests/Properties.txt index 4d021aa825c..76fdf04cf3e 100644 --- a/compiler/testData/diagnostics/tests/Properties.txt +++ b/compiler/testData/diagnostics/tests/Properties.txt @@ -10,7 +10,6 @@ public final class Test { public final var b: kotlin.Int public final val i: kotlin.Int = 1 public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun f(): kotlin.Unit public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } diff --git a/compiler/testData/diagnostics/tests/backingField/CustomGetSet.kt b/compiler/testData/diagnostics/tests/backingField/CustomGetSet.kt index 2320f9f786c..db201619dcb 100644 --- a/compiler/testData/diagnostics/tests/backingField/CustomGetSet.kt +++ b/compiler/testData/diagnostics/tests/backingField/CustomGetSet.kt @@ -3,9 +3,4 @@ class Flower() { var minusOne: Int = 1 get() = field + 1 set(n: Int) { field = n - 1 } - - var oldSyntax: Int = 1 - get() = $oldSyntax - 1 - set(arg) { $oldSyntax = arg + 1 } - } diff --git a/compiler/testData/diagnostics/tests/backingField/CustomGetSet.txt b/compiler/testData/diagnostics/tests/backingField/CustomGetSet.txt index 86a6c64010d..f94d0152153 100644 --- a/compiler/testData/diagnostics/tests/backingField/CustomGetSet.txt +++ b/compiler/testData/diagnostics/tests/backingField/CustomGetSet.txt @@ -3,7 +3,6 @@ package public final class Flower { public constructor Flower() public final var minusOne: kotlin.Int - public final var oldSyntax: kotlin.Int public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String diff --git a/compiler/testData/diagnostics/tests/backingField/CyclicReferenceInitializer.kt b/compiler/testData/diagnostics/tests/backingField/CyclicReferenceInitializer.kt deleted file mode 100644 index 088063e7df9..00000000000 --- a/compiler/testData/diagnostics/tests/backingField/CyclicReferenceInitializer.kt +++ /dev/null @@ -1,3 +0,0 @@ -class Cyclic() { - val a = $a -} diff --git a/compiler/testData/diagnostics/tests/backingField/CyclicReferenceInitializer.txt b/compiler/testData/diagnostics/tests/backingField/CyclicReferenceInitializer.txt deleted file mode 100644 index 9292cc6e210..00000000000 --- a/compiler/testData/diagnostics/tests/backingField/CyclicReferenceInitializer.txt +++ /dev/null @@ -1,9 +0,0 @@ -package - -public final class Cyclic { - public constructor Cyclic() - public final val a: [ERROR : Type for $a] - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String -} diff --git a/compiler/testData/diagnostics/tests/backingField/ReadNonexistentAbstractPropertyInAnonymous.kt b/compiler/testData/diagnostics/tests/backingField/ReadNonexistentAbstractPropertyInAnonymous.kt deleted file mode 100644 index d826a3e73f0..00000000000 --- a/compiler/testData/diagnostics/tests/backingField/ReadNonexistentAbstractPropertyInAnonymous.kt +++ /dev/null @@ -1,7 +0,0 @@ -abstract class ReadNonexistent() { - abstract val aa: Int - - init { - val x = $aa - } -} diff --git a/compiler/testData/diagnostics/tests/backingField/ReadNonexistentAbstractPropertyInAnonymous.txt b/compiler/testData/diagnostics/tests/backingField/ReadNonexistentAbstractPropertyInAnonymous.txt deleted file mode 100644 index 0508f2e6dd2..00000000000 --- a/compiler/testData/diagnostics/tests/backingField/ReadNonexistentAbstractPropertyInAnonymous.txt +++ /dev/null @@ -1,9 +0,0 @@ -package - -public abstract class ReadNonexistent { - public constructor ReadNonexistent() - public abstract val aa: kotlin.Int - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String -} diff --git a/compiler/testData/diagnostics/tests/backingField/ReadNonexistentAbstractPropertyInFunction.kt b/compiler/testData/diagnostics/tests/backingField/ReadNonexistentAbstractPropertyInFunction.kt deleted file mode 100644 index cd9ddf516f4..00000000000 --- a/compiler/testData/diagnostics/tests/backingField/ReadNonexistentAbstractPropertyInFunction.kt +++ /dev/null @@ -1,5 +0,0 @@ -abstract class ReadNonexistent { - abstract val aa: Int - - fun ff() = $aa -} diff --git a/compiler/testData/diagnostics/tests/backingField/ReadNonexistentAbstractPropertyInFunction.txt b/compiler/testData/diagnostics/tests/backingField/ReadNonexistentAbstractPropertyInFunction.txt deleted file mode 100644 index 6aaffa2ee42..00000000000 --- a/compiler/testData/diagnostics/tests/backingField/ReadNonexistentAbstractPropertyInFunction.txt +++ /dev/null @@ -1,10 +0,0 @@ -package - -public abstract class ReadNonexistent { - public constructor ReadNonexistent() - public abstract val aa: kotlin.Int - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun ff(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String -} diff --git a/compiler/testData/diagnostics/tests/backingField/ReadNonexistentCustomGetInAnonymous.kt b/compiler/testData/diagnostics/tests/backingField/ReadNonexistentCustomGetInAnonymous.kt deleted file mode 100644 index 7dfb6133b9c..00000000000 --- a/compiler/testData/diagnostics/tests/backingField/ReadNonexistentCustomGetInAnonymous.kt +++ /dev/null @@ -1,8 +0,0 @@ -class ReadNonexistent() { - val a: Int - get() = 1 - - init { - val x = $a - } -} diff --git a/compiler/testData/diagnostics/tests/backingField/ReadNonexistentCustomGetInAnonymous.txt b/compiler/testData/diagnostics/tests/backingField/ReadNonexistentCustomGetInAnonymous.txt deleted file mode 100644 index 437c678e015..00000000000 --- a/compiler/testData/diagnostics/tests/backingField/ReadNonexistentCustomGetInAnonymous.txt +++ /dev/null @@ -1,9 +0,0 @@ -package - -public final class ReadNonexistent { - public constructor ReadNonexistent() - public final val a: kotlin.Int - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String -} diff --git a/compiler/testData/diagnostics/tests/backingField/ReadNonexistentCustomGetInAnotherInitializer.kt b/compiler/testData/diagnostics/tests/backingField/ReadNonexistentCustomGetInAnotherInitializer.kt deleted file mode 100644 index fd9c8bab3f5..00000000000 --- a/compiler/testData/diagnostics/tests/backingField/ReadNonexistentCustomGetInAnotherInitializer.kt +++ /dev/null @@ -1,6 +0,0 @@ -class CustomValNoBackingField() { - val a: Int - get() = 1 - - val b = $a -} diff --git a/compiler/testData/diagnostics/tests/backingField/ReadNonexistentCustomGetInAnotherInitializer.txt b/compiler/testData/diagnostics/tests/backingField/ReadNonexistentCustomGetInAnotherInitializer.txt deleted file mode 100644 index 39cbc31db69..00000000000 --- a/compiler/testData/diagnostics/tests/backingField/ReadNonexistentCustomGetInAnotherInitializer.txt +++ /dev/null @@ -1,10 +0,0 @@ -package - -public final class CustomValNoBackingField { - public constructor CustomValNoBackingField() - public final val a: kotlin.Int - public final val b: kotlin.Int - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String -} diff --git a/compiler/testData/diagnostics/tests/backingField/ReadNonexistentDeclaredInHigher.kt b/compiler/testData/diagnostics/tests/backingField/ReadNonexistentDeclaredInHigher.kt deleted file mode 100644 index fd9c8bab3f5..00000000000 --- a/compiler/testData/diagnostics/tests/backingField/ReadNonexistentDeclaredInHigher.kt +++ /dev/null @@ -1,6 +0,0 @@ -class CustomValNoBackingField() { - val a: Int - get() = 1 - - val b = $a -} diff --git a/compiler/testData/diagnostics/tests/backingField/ReadNonexistentDeclaredInHigher.txt b/compiler/testData/diagnostics/tests/backingField/ReadNonexistentDeclaredInHigher.txt deleted file mode 100644 index 39cbc31db69..00000000000 --- a/compiler/testData/diagnostics/tests/backingField/ReadNonexistentDeclaredInHigher.txt +++ /dev/null @@ -1,10 +0,0 @@ -package - -public final class CustomValNoBackingField { - public constructor CustomValNoBackingField() - public final val a: kotlin.Int - public final val b: kotlin.Int - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String -} diff --git a/compiler/testData/diagnostics/tests/backingField/ReadNonexistentPropertyInAnonymous.kt b/compiler/testData/diagnostics/tests/backingField/ReadNonexistentPropertyInAnonymous.kt deleted file mode 100644 index 5b5a89f2a25..00000000000 --- a/compiler/testData/diagnostics/tests/backingField/ReadNonexistentPropertyInAnonymous.kt +++ /dev/null @@ -1,5 +0,0 @@ -class Cl() { - init { - val x = $a - } -} diff --git a/compiler/testData/diagnostics/tests/backingField/ReadNonexistentPropertyInAnonymous.txt b/compiler/testData/diagnostics/tests/backingField/ReadNonexistentPropertyInAnonymous.txt deleted file mode 100644 index a217a6cdc4b..00000000000 --- a/compiler/testData/diagnostics/tests/backingField/ReadNonexistentPropertyInAnonymous.txt +++ /dev/null @@ -1,8 +0,0 @@ -package - -public final class Cl { - public constructor Cl() - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String -} diff --git a/compiler/testData/diagnostics/tests/backingField/WriteNonexistentDeclaredInHigher.kt b/compiler/testData/diagnostics/tests/backingField/WriteNonexistentDeclaredInHigher.kt deleted file mode 100644 index d35b0a3d4ae..00000000000 --- a/compiler/testData/diagnostics/tests/backingField/WriteNonexistentDeclaredInHigher.kt +++ /dev/null @@ -1,7 +0,0 @@ -val y = 1 - -class A() { - init { - $y = 1 - } -} diff --git a/compiler/testData/diagnostics/tests/backingField/WriteNonexistentDeclaredInHigher.txt b/compiler/testData/diagnostics/tests/backingField/WriteNonexistentDeclaredInHigher.txt deleted file mode 100644 index 0ae0f7b87fd..00000000000 --- a/compiler/testData/diagnostics/tests/backingField/WriteNonexistentDeclaredInHigher.txt +++ /dev/null @@ -1,10 +0,0 @@ -package - -public val y: kotlin.Int = 1 - -public final class A { - public constructor A() - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String -} diff --git a/compiler/testData/diagnostics/tests/backingField/kt782packageLevel.kt b/compiler/testData/diagnostics/tests/backingField/kt782packageLevel.kt index 4bb2c9d40c7..a5bd01f37dc 100644 --- a/compiler/testData/diagnostics/tests/backingField/kt782packageLevel.kt +++ b/compiler/testData/diagnostics/tests/backingField/kt782packageLevel.kt @@ -12,9 +12,5 @@ get() { val x : Int get() = z -val w : Int -get() = $z - -fun foo() { - $y = 34 -} +val w : Int = 56 +get() = field \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/backingField/kt782packageLevel.txt b/compiler/testData/diagnostics/tests/backingField/kt782packageLevel.txt index 7098494ffa2..88f472c9a93 100644 --- a/compiler/testData/diagnostics/tests/backingField/kt782packageLevel.txt +++ b/compiler/testData/diagnostics/tests/backingField/kt782packageLevel.txt @@ -1,9 +1,8 @@ package package kt782 { - public val w: kotlin.Int + public val w: kotlin.Int = 56 public val x: kotlin.Int public val y: kotlin.Int = 11 public val z: kotlin.Int = 34 - public fun foo(): kotlin.Unit } diff --git a/compiler/testData/diagnostics/tests/backingField/qualifiedWithThis.kt b/compiler/testData/diagnostics/tests/backingField/qualifiedWithThis.kt deleted file mode 100644 index f989e7358ac..00000000000 --- a/compiler/testData/diagnostics/tests/backingField/qualifiedWithThis.kt +++ /dev/null @@ -1,4 +0,0 @@ -abstract class Bar { - abstract var bar : String - fun foo() = "foo" + this.$bar -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/backingField/qualifiedWithThis.txt b/compiler/testData/diagnostics/tests/backingField/qualifiedWithThis.txt deleted file mode 100644 index a95379f4e2e..00000000000 --- a/compiler/testData/diagnostics/tests/backingField/qualifiedWithThis.txt +++ /dev/null @@ -1,10 +0,0 @@ -package - -public abstract class Bar { - public constructor Bar() - public abstract var bar: kotlin.String - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun foo(): kotlin.String - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String -} diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/UninitializedOrReassignedVariables.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/UninitializedOrReassignedVariables.kt index 43ee9fc7dcb..52515759ca8 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/UninitializedOrReassignedVariables.kt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/UninitializedOrReassignedVariables.kt @@ -135,7 +135,6 @@ class AnonymousInitializers(var a: String, val b: String) { init { i = 13 - $j = 30 j = 34 } @@ -241,7 +240,7 @@ class Outer() { } class ForwardAccessToBackingField() { //kt-147 - val a = $a // error + val a = a // error val b = c // error val c = 1 } @@ -327,7 +326,6 @@ fun func() { val x = b init { b = 4 - $b = 3 } } } diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/UninitializedOrReassignedVariables.txt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/UninitializedOrReassignedVariables.txt index 3a315a77cef..f8afcd1d8db 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/UninitializedOrReassignedVariables.txt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/UninitializedOrReassignedVariables.txt @@ -61,7 +61,7 @@ package uninitialized_reassigned_variables { public final class ForwardAccessToBackingField { public constructor ForwardAccessToBackingField() - public final val a: [ERROR : Type for $a] + public final val a: [ERROR : Type for a] public final val b: kotlin.Int = 1 public final val c: kotlin.Int = 1 public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/backingField.kt b/compiler/testData/diagnostics/tests/delegatedProperty/backingField.kt index 03efeff5892..7ad3dc1881f 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/backingField.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/backingField.kt @@ -5,7 +5,7 @@ import kotlin.reflect.KProperty class B { val a: Int by Delegate() - fun foo() = $a + fun foo() = $a } class Delegate { diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/backingField.txt b/compiler/testData/diagnostics/tests/delegatedProperty/backingField.txt index 346116f9a20..b4cd5e8059a 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/backingField.txt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/backingField.txt @@ -4,7 +4,7 @@ public final class B { public constructor B() public final val a: kotlin.Int public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun foo(): kotlin.Int + public final fun foo(): [ERROR : No type, no body] public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } diff --git a/compiler/testData/diagnostics/tests/incompleteCode/diagnosticWithSyntaxError/checkBackingFieldException.kt b/compiler/testData/diagnostics/tests/incompleteCode/diagnosticWithSyntaxError/checkBackingFieldException.kt index 73d827481ad..48172de15ff 100644 --- a/compiler/testData/diagnostics/tests/incompleteCode/diagnosticWithSyntaxError/checkBackingFieldException.kt +++ b/compiler/testData/diagnostics/tests/incompleteCode/diagnosticWithSyntaxError/checkBackingFieldException.kt @@ -3,7 +3,7 @@ package h class Square() { var size : Double = set(value) { - $area = size * size + $area = size * size } var area : Double diff --git a/compiler/testData/diagnostics/tests/scopes/kt250.617.10.kt b/compiler/testData/diagnostics/tests/scopes/kt250.617.10.kt index 1cfbadc003e..8129834a443 100644 --- a/compiler/testData/diagnostics/tests/scopes/kt250.617.10.kt +++ b/compiler/testData/diagnostics/tests/scopes/kt250.617.10.kt @@ -9,7 +9,7 @@ class B(y: Int) : A(x) //x is //KT-617 Prohibit dollars in call to superclass constructors open class M(p: Int) -class N(val p: Int) : A($p) +class N(val p: Int) : A($p) //KT-10 Don't allow to use properties in supertype initializers open class Element() diff --git a/compiler/testData/psi/examples/priorityqueues/BinaryHeap.kt b/compiler/testData/psi/examples/priorityqueues/BinaryHeap.kt index a5ecdc4d697..dca2c78e6cf 100644 --- a/compiler/testData/psi/examples/priorityqueues/BinaryHeap.kt +++ b/compiler/testData/psi/examples/priorityqueues/BinaryHeap.kt @@ -79,7 +79,7 @@ class BinaryHeap : IPriorityQueue { val Int.value : T = foo.bar() get() = data[this] set(it) { - $value = it + field = it } diff --git a/compiler/testData/psi/examples/priorityqueues/BinaryHeap.txt b/compiler/testData/psi/examples/priorityqueues/BinaryHeap.txt index 5ea99b9e79e..acb0acf3977 100644 --- a/compiler/testData/psi/examples/priorityqueues/BinaryHeap.txt +++ b/compiler/testData/psi/examples/priorityqueues/BinaryHeap.txt @@ -837,7 +837,7 @@ JetFile: BinaryHeap.kt PsiWhiteSpace('\n ') BINARY_EXPRESSION REFERENCE_EXPRESSION - PsiElement(FIELD_IDENTIFIER)('$value') + PsiElement(IDENTIFIER)('field') PsiWhiteSpace(' ') OPERATION_REFERENCE PsiElement(EQ)('=') diff --git a/compiler/testData/resolve/labels/labelForPropertyInSetter.resolve b/compiler/testData/resolve/labels/labelForPropertyInSetter.resolve index b53b527f8ee..a1383f65739 100644 --- a/compiler/testData/resolve/labels/labelForPropertyInSetter.resolve +++ b/compiler/testData/resolve/labels/labelForPropertyInSetter.resolve @@ -4,12 +4,12 @@ interface Base { var ~setter1~Int.setter1: Int = 2 set(i: Int) { - $setter1 = `setter1`this@setter1 + field = `setter1`this@setter1 } var ~setter2~Int.setter2: Base? = null set(i: Base?) { - $setter2 = object: Base { + field = object: Base { override fun foo() { `setter2`this@setter2 } diff --git a/compiler/tests/org/jetbrains/kotlin/cfg/ControlFlowTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/cfg/ControlFlowTestGenerated.java index 519412dd5ff..a05e3e8a01d 100644 --- a/compiler/tests/org/jetbrains/kotlin/cfg/ControlFlowTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/cfg/ControlFlowTestGenerated.java @@ -480,18 +480,6 @@ public class ControlFlowTestGenerated extends AbstractControlFlowTest { JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/cfg/declarations/properties"), Pattern.compile("^(.+)\\.kt$"), true); } - @TestMetadata("backingFieldAccess.kt") - public void testBackingFieldAccess() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/cfg/declarations/properties/backingFieldAccess.kt"); - doTest(fileName); - } - - @TestMetadata("backingFieldQualifiedWithThis.kt") - public void testBackingFieldQualifiedWithThis() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/cfg/declarations/properties/backingFieldQualifiedWithThis.kt"); - doTest(fileName); - } - @TestMetadata("DelegatedProperty.kt") public void testDelegatedProperty() throws Exception { String fileName = JetTestUtils.navigationMetadata("compiler/testData/cfg/declarations/properties/DelegatedProperty.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/cfg/PseudoValueTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/cfg/PseudoValueTestGenerated.java index 620c7f836d6..aad75af23f9 100644 --- a/compiler/tests/org/jetbrains/kotlin/cfg/PseudoValueTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/cfg/PseudoValueTestGenerated.java @@ -482,18 +482,6 @@ public class PseudoValueTestGenerated extends AbstractPseudoValueTest { JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/cfg/declarations/properties"), Pattern.compile("^(.+)\\.kt$"), true); } - @TestMetadata("backingFieldAccess.kt") - public void testBackingFieldAccess() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/cfg/declarations/properties/backingFieldAccess.kt"); - doTest(fileName); - } - - @TestMetadata("backingFieldQualifiedWithThis.kt") - public void testBackingFieldQualifiedWithThis() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/cfg/declarations/properties/backingFieldQualifiedWithThis.kt"); - doTest(fileName); - } - @TestMetadata("DelegatedProperty.kt") public void testDelegatedProperty() throws Exception { String fileName = JetTestUtils.navigationMetadata("compiler/testData/cfg/declarations/properties/DelegatedProperty.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java index 44cc2c1e217..86ba0d3d555 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java @@ -1476,12 +1476,6 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest { doTest(fileName); } - @TestMetadata("CyclicReferenceInitializer.kt") - public void testCyclicReferenceInitializer() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/backingField/CyclicReferenceInitializer.kt"); - doTest(fileName); - } - @TestMetadata("ExtensionProperty.kt") public void testExtensionProperty() throws Exception { String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/backingField/ExtensionProperty.kt"); @@ -1559,54 +1553,6 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest { String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/backingField/kt782packageLevel.kt"); doTest(fileName); } - - @TestMetadata("qualifiedWithThis.kt") - public void testQualifiedWithThis() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/backingField/qualifiedWithThis.kt"); - doTest(fileName); - } - - @TestMetadata("ReadNonexistentAbstractPropertyInAnonymous.kt") - public void testReadNonexistentAbstractPropertyInAnonymous() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/backingField/ReadNonexistentAbstractPropertyInAnonymous.kt"); - doTest(fileName); - } - - @TestMetadata("ReadNonexistentAbstractPropertyInFunction.kt") - public void testReadNonexistentAbstractPropertyInFunction() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/backingField/ReadNonexistentAbstractPropertyInFunction.kt"); - doTest(fileName); - } - - @TestMetadata("ReadNonexistentCustomGetInAnonymous.kt") - public void testReadNonexistentCustomGetInAnonymous() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/backingField/ReadNonexistentCustomGetInAnonymous.kt"); - doTest(fileName); - } - - @TestMetadata("ReadNonexistentCustomGetInAnotherInitializer.kt") - public void testReadNonexistentCustomGetInAnotherInitializer() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/backingField/ReadNonexistentCustomGetInAnotherInitializer.kt"); - doTest(fileName); - } - - @TestMetadata("ReadNonexistentDeclaredInHigher.kt") - public void testReadNonexistentDeclaredInHigher() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/backingField/ReadNonexistentDeclaredInHigher.kt"); - doTest(fileName); - } - - @TestMetadata("ReadNonexistentPropertyInAnonymous.kt") - public void testReadNonexistentPropertyInAnonymous() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/backingField/ReadNonexistentPropertyInAnonymous.kt"); - doTest(fileName); - } - - @TestMetadata("WriteNonexistentDeclaredInHigher.kt") - public void testWriteNonexistentDeclaredInHigher() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/backingField/WriteNonexistentDeclaredInHigher.kt"); - doTest(fileName); - } } @TestMetadata("compiler/testData/diagnostics/tests/callableReference") diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/highlighter/PropertiesHighlightingVisitor.java b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/highlighter/PropertiesHighlightingVisitor.java index dd3e6190872..7d127699501 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/highlighter/PropertiesHighlightingVisitor.java +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/highlighter/PropertiesHighlightingVisitor.java @@ -52,9 +52,6 @@ class PropertiesHighlightingVisitor extends AfterAnalysisHighlightingVisitor { } highlightProperty(expression, (PropertyDescriptor) target, false); - if (expression.getReferencedNameElementType() == KtTokens.FIELD_IDENTIFIER) { - NameHighlighter.highlightName(holder, expression, JetHighlightingColors.BACKING_FIELD_ACCESS); - } } @Override diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/references/KtSimpleNameReference.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/references/KtSimpleNameReference.kt index acb7994db22..9a1ea1b5016 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/references/KtSimpleNameReference.kt +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/references/KtSimpleNameReference.kt @@ -84,16 +84,10 @@ class KtSimpleNameReference(expression: KtSimpleNameExpression) : KtSimpleRefere } val psiFactory = KtPsiFactory(expression) - val element = when (expression.getReferencedNameElementType()) { - KtTokens.FIELD_IDENTIFIER -> psiFactory.createFieldIdentifier(newElementName) - - else -> { - Extensions.getArea(expression.getProject()).getExtensionPoint(SimpleNameReferenceExtension.EP_NAME).getExtensions() + val element = Extensions.getArea(expression.getProject()).getExtensionPoint(SimpleNameReferenceExtension.EP_NAME).extensions .asSequence() .map { it.handleElementRename(this, psiFactory, newElementName) } .firstOrNull { it != null } ?: psiFactory.createNameIdentifier(newElementName) - } - } val nameElement = expression.getReferencedNameElement() diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/search/KotlinIndexers.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/search/KotlinIndexers.kt index 553cd80ab5b..ce85c000511 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/search/KotlinIndexers.kt +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/search/KotlinIndexers.kt @@ -37,7 +37,7 @@ val KOTLIN_NAMED_ARGUMENT_SEARCH_CONTEXT: Short = 0x20 class KotlinFilterLexer(private val occurrenceConsumer: OccurrenceConsumer): BaseFilterLexer(KotlinLexer(), occurrenceConsumer) { private val codeTokens = TokenSet.orSet( TokenSet.create(*ALL_SEARCHABLE_OPERATIONS.toTypedArray()), - TokenSet.create(KtTokens.IDENTIFIER, KtTokens.FIELD_IDENTIFIER) + TokenSet.create(KtTokens.IDENTIFIER) ) private val commentTokens = TokenSet.orSet(KtTokens.COMMENTS, TokenSet.create(KDocTokens.KDOC)) diff --git a/idea/idea-completion/testData/basic/common/CompletionInSetter.kt b/idea/idea-completion/testData/basic/common/CompletionInSetter.kt index a77a384356a..06a2bfa9587 100644 --- a/idea/idea-completion/testData/basic/common/CompletionInSetter.kt +++ b/idea/idea-completion/testData/basic/common/CompletionInSetter.kt @@ -1,9 +1,9 @@ val a: Int = 1 get() { - return $a + return field } set(v) { - $a = + field = } diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/KotlinCleanupInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/KotlinCleanupInspection.kt index 0143b8507b6..1f3caa6affe 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/KotlinCleanupInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/KotlinCleanupInspection.kt @@ -90,7 +90,6 @@ public class KotlinCleanupInspection(): LocalInspectionTool(), CleanupLocalInspe ErrorsJvm.POSITIONED_VALUE_ARGUMENT_FOR_JAVA_ANNOTATION, Errors.DEPRECATION, Errors.NON_CONST_VAL_USED_IN_CONSTANT_EXPRESSION, - Errors.BACKING_FIELD_OLD_SYNTAX, Errors.OPERATOR_MODIFIER_REQUIRED, Errors.DEPRECATED_UNARY_PLUS_MINUS, Errors.DELEGATE_RESOLVED_TO_DEPRECATED_CONVENTION, diff --git a/idea/src/org/jetbrains/kotlin/idea/intentions/IntroduceBackingPropertyIntention.kt b/idea/src/org/jetbrains/kotlin/idea/intentions/IntroduceBackingPropertyIntention.kt index a2750854432..f209129bba7 100644 --- a/idea/src/org/jetbrains/kotlin/idea/intentions/IntroduceBackingPropertyIntention.kt +++ b/idea/src/org/jetbrains/kotlin/idea/intentions/IntroduceBackingPropertyIntention.kt @@ -82,8 +82,6 @@ class IntroduceBackingPropertyIntention(): JetSelfTargetingIntention } property.setInitializer(null) - - replaceBackingFieldReferences(property) } private fun createGetter(element: KtProperty) { @@ -136,17 +134,6 @@ class IntroduceBackingPropertyIntention(): JetSelfTargetingIntention } }) } - - // TODO: drop this when we get rid of backing field syntax - private fun replaceBackingFieldReferences(prop: KtProperty) { - val containingClass = prop.getStrictParentOfType()!! - ReferencesSearch.search(prop, LocalSearchScope(containingClass)).forEach { - val element = it.element as? KtNameReferenceExpression - if (element != null && element.getReferencedNameElementType() == KtTokens.FIELD_IDENTIFIER) { - element.replace(KtPsiFactory(element).createSimpleName("_${prop.name}")) - } - } - } } } diff --git a/idea/src/org/jetbrains/kotlin/idea/quickfix/QuickFixRegistrar.kt b/idea/src/org/jetbrains/kotlin/idea/quickfix/QuickFixRegistrar.kt index 0e04929622b..4bc55ecda14 100644 --- a/idea/src/org/jetbrains/kotlin/idea/quickfix/QuickFixRegistrar.kt +++ b/idea/src/org/jetbrains/kotlin/idea/quickfix/QuickFixRegistrar.kt @@ -331,10 +331,6 @@ public class QuickFixRegistrar : QuickFixContributor { NON_CONST_VAL_USED_IN_CONSTANT_EXPRESSION.registerFactory(ConstFixFactory) - BACKING_FIELD_OLD_SYNTAX.registerFactory(MigrateBackingFieldSyntaxFix) - BACKING_FIELD_USAGE_FORBIDDEN.registerFactory(MigrateBackingFieldUsageFix) - BACKING_FIELD_USAGE_FORBIDDEN.registerFactory(IntroduceBackingPropertyFix) - OPERATOR_MODIFIER_REQUIRED.registerFactory(AddModifierFixFactory(KtTokens.OPERATOR_KEYWORD)) INFIX_MODIFIER_REQUIRED.registerFactory(AddModifierFixFactory(KtTokens.INFIX_KEYWORD)) diff --git a/idea/testData/checker/AnonymousInitializers.kt b/idea/testData/checker/AnonymousInitializers.kt index 0ab0483f4f2..7adf0b316d5 100644 --- a/idea/testData/checker/AnonymousInitializers.kt +++ b/idea/testData/checker/AnonymousInitializers.kt @@ -11,10 +11,8 @@ interface NoC { } class WithC() { - val x : Int + val x : Int = 42 init { - $x = 1 - $y = 2 val b = x } @@ -24,7 +22,6 @@ class WithC() { init { val z = b val zz = x - val zzz = $a } } \ No newline at end of file diff --git a/idea/testData/checker/Constructors.kt b/idea/testData/checker/Constructors.kt index 204242dcba3..c9360f22d94 100644 --- a/idea/testData/checker/Constructors.kt +++ b/idea/testData/checker/Constructors.kt @@ -28,7 +28,6 @@ class WithCPI_Dup(x : Int) { class WithCPI(x : Int) { val a = 1 - val b : Int = $a val xy : Int = x } diff --git a/idea/testData/checker/regression/Jet17.kt b/idea/testData/checker/regression/Jet17.kt deleted file mode 100644 index 72d81949e12..00000000000 --- a/idea/testData/checker/regression/Jet17.kt +++ /dev/null @@ -1,6 +0,0 @@ -// JET-17 Do not infer property types by the initializer before the containing scope is ready - -class WithC() { - val a = 1 - val b = $a // error here, but must not be -} \ No newline at end of file diff --git a/idea/testData/inspections/cleanup/cleanup.kt b/idea/testData/inspections/cleanup/cleanup.kt index 5d8dd295b16..f154bd68e33 100644 --- a/idea/testData/inspections/cleanup/cleanup.kt +++ b/idea/testData/inspections/cleanup/cleanup.kt @@ -39,12 +39,6 @@ annotation class Fancy(val param: Int) @Fancy(i) class D -class Foo { - var x: Int = 0 - get = $x - set(value) { $x = value } -} - class CustomDelegate { operator fun get(thisRef: Any?, prop: PropertyMetadata): String = "" operator fun set(thisRef: Any?, prop: PropertyMetadata, value: String) {} diff --git a/idea/testData/inspections/cleanup/cleanup.kt.after b/idea/testData/inspections/cleanup/cleanup.kt.after index 34846fc6ab0..70c9623aa18 100644 --- a/idea/testData/inspections/cleanup/cleanup.kt.after +++ b/idea/testData/inspections/cleanup/cleanup.kt.after @@ -39,12 +39,6 @@ annotation class Fancy(val param: Int) @Fancy(i) class D -class Foo { - var x: Int = 0 - get = field - set(value) { field = value } -} - class CustomDelegate { operator fun getValue(thisRef: Any?, prop: KProperty<*>): String = "" operator fun setValue(thisRef: Any?, prop: KProperty<*>, value: String) {} diff --git a/idea/testData/quickfix/abstract/abstractPropertyWithGetter2.kt b/idea/testData/quickfix/abstract/abstractPropertyWithGetter2.kt index 4466a5712a5..9ebc33d5215 100644 --- a/idea/testData/quickfix/abstract/abstractPropertyWithGetter2.kt +++ b/idea/testData/quickfix/abstract/abstractPropertyWithGetter2.kt @@ -1,5 +1,5 @@ // "Remove getter and initializer from property" "true" abstract class B { abstract val i = 0 - get() = $i + get() = field } \ No newline at end of file diff --git a/idea/testData/quickfix/migration/backingFieldSyntax/accessor.kt b/idea/testData/quickfix/migration/backingFieldSyntax/accessor.kt deleted file mode 100644 index 7c6a4d14da3..00000000000 --- a/idea/testData/quickfix/migration/backingFieldSyntax/accessor.kt +++ /dev/null @@ -1,7 +0,0 @@ -// "Migrate backing field syntax" "true" - -class Foo { - var a: Int = 0 - get() = 0 - set(v) { $a = v } -} diff --git a/idea/testData/quickfix/migration/backingFieldSyntax/accessor.kt.after b/idea/testData/quickfix/migration/backingFieldSyntax/accessor.kt.after deleted file mode 100644 index a505a403297..00000000000 --- a/idea/testData/quickfix/migration/backingFieldSyntax/accessor.kt.after +++ /dev/null @@ -1,7 +0,0 @@ -// "Migrate backing field syntax" "true" - -class Foo { - var a: Int = 0 - get() = 0 - set(v) { field = v } -} diff --git a/idea/testData/quickfix/migration/backingFieldSyntax/introduceBackingField.kt b/idea/testData/quickfix/migration/backingFieldSyntax/introduceBackingField.kt deleted file mode 100644 index 9531d94def6..00000000000 --- a/idea/testData/quickfix/migration/backingFieldSyntax/introduceBackingField.kt +++ /dev/null @@ -1,11 +0,0 @@ -// "Introduce backing property" "true" - -class Foo { - var x = "" - get() = $x + "!" - set(value) { $x = value + "!" } - - fun foo(): String { - return $x - } -} diff --git a/idea/testData/quickfix/migration/backingFieldSyntax/introduceBackingField.kt.after b/idea/testData/quickfix/migration/backingFieldSyntax/introduceBackingField.kt.after deleted file mode 100644 index 64c7fcb1bc4..00000000000 --- a/idea/testData/quickfix/migration/backingFieldSyntax/introduceBackingField.kt.after +++ /dev/null @@ -1,12 +0,0 @@ -// "Introduce backing property" "true" - -class Foo { - private var _x = "" - var x: String - get() = _x + "!" - set(value) { _x = value + "!" } - - fun foo(): String { - return _x - } -} diff --git a/idea/testData/quickfix/migration/backingFieldSyntax/usage.kt b/idea/testData/quickfix/migration/backingFieldSyntax/usage.kt deleted file mode 100644 index 8a7050df798..00000000000 --- a/idea/testData/quickfix/migration/backingFieldSyntax/usage.kt +++ /dev/null @@ -1,7 +0,0 @@ -// "Replace with property access" "true" - -class A { - var foo: Int = 0 - - fun bar() = $foo -} diff --git a/idea/testData/quickfix/migration/backingFieldSyntax/usage.kt.after b/idea/testData/quickfix/migration/backingFieldSyntax/usage.kt.after deleted file mode 100644 index 6647987db29..00000000000 --- a/idea/testData/quickfix/migration/backingFieldSyntax/usage.kt.after +++ /dev/null @@ -1,7 +0,0 @@ -// "Replace with property access" "true" - -class A { - var foo: Int = 0 - - fun bar() = foo -} diff --git a/idea/testData/quickfix/variables/changeToPropertyName/abstractProperty.kt b/idea/testData/quickfix/variables/changeToPropertyName/abstractProperty.kt deleted file mode 100644 index b5bfa697e7b..00000000000 --- a/idea/testData/quickfix/variables/changeToPropertyName/abstractProperty.kt +++ /dev/null @@ -1,5 +0,0 @@ -// "Change '$foo' to 'foo'" "true" -abstract class Foo { - abstract var foo : String - fun bar() = $foo + "bar" -} \ No newline at end of file diff --git a/idea/testData/quickfix/variables/changeToPropertyName/abstractProperty.kt.after b/idea/testData/quickfix/variables/changeToPropertyName/abstractProperty.kt.after deleted file mode 100644 index 15978aa5637..00000000000 --- a/idea/testData/quickfix/variables/changeToPropertyName/abstractProperty.kt.after +++ /dev/null @@ -1,5 +0,0 @@ -// "Change '$foo' to 'foo'" "true" -abstract class Foo { - abstract var foo : String - fun bar() = foo + "bar" -} \ No newline at end of file diff --git a/idea/testData/quickfix/variables/changeToPropertyName/abstractPropertyThis.kt b/idea/testData/quickfix/variables/changeToPropertyName/abstractPropertyThis.kt deleted file mode 100644 index a8ef24c3e2c..00000000000 --- a/idea/testData/quickfix/variables/changeToPropertyName/abstractPropertyThis.kt +++ /dev/null @@ -1,5 +0,0 @@ -// "Change '$bar' to 'bar'" "true" -abstract class Bar { - abstract var bar : String - fun foo() = "foo" + this.$bar -} \ No newline at end of file diff --git a/idea/testData/quickfix/variables/changeToPropertyName/abstractPropertyThis.kt.after b/idea/testData/quickfix/variables/changeToPropertyName/abstractPropertyThis.kt.after deleted file mode 100644 index 6a2ed782cb6..00000000000 --- a/idea/testData/quickfix/variables/changeToPropertyName/abstractPropertyThis.kt.after +++ /dev/null @@ -1,5 +0,0 @@ -// "Change '$bar' to 'bar'" "true" -abstract class Bar { - abstract var bar : String - fun foo() = "foo" + this.bar -} \ No newline at end of file diff --git a/idea/testData/quickfix/variables/changeToPropertyName/customAccessors.kt b/idea/testData/quickfix/variables/changeToPropertyName/customAccessors.kt deleted file mode 100644 index 1e26332be86..00000000000 --- a/idea/testData/quickfix/variables/changeToPropertyName/customAccessors.kt +++ /dev/null @@ -1,7 +0,0 @@ -// "Change '$foo' to 'foo'" "true" -class A { - val foo : Int - get() = 5 - val bar : Int - get() = $foo -} \ No newline at end of file diff --git a/idea/testData/quickfix/variables/changeToPropertyName/customAccessors.kt.after b/idea/testData/quickfix/variables/changeToPropertyName/customAccessors.kt.after deleted file mode 100644 index 3563ff95eaf..00000000000 --- a/idea/testData/quickfix/variables/changeToPropertyName/customAccessors.kt.after +++ /dev/null @@ -1,7 +0,0 @@ -// "Change '$foo' to 'foo'" "true" -class A { - val foo : Int - get() = 5 - val bar : Int - get() = foo -} \ No newline at end of file diff --git a/idea/testData/quickfix/variables/changeToPropertyName/inaccessibleBackingField.kt b/idea/testData/quickfix/variables/changeToPropertyName/inaccessibleBackingField.kt deleted file mode 100644 index 9612356fc4d..00000000000 --- a/idea/testData/quickfix/variables/changeToPropertyName/inaccessibleBackingField.kt +++ /dev/null @@ -1,5 +0,0 @@ -// "Change '$a' to 'a'" "true" -val a = 5 -class A { - val b = $a -} \ No newline at end of file diff --git a/idea/testData/quickfix/variables/changeToPropertyName/inaccessibleBackingField.kt.after b/idea/testData/quickfix/variables/changeToPropertyName/inaccessibleBackingField.kt.after deleted file mode 100644 index a53e74f1388..00000000000 --- a/idea/testData/quickfix/variables/changeToPropertyName/inaccessibleBackingField.kt.after +++ /dev/null @@ -1,5 +0,0 @@ -// "Change '$a' to 'a'" "true" -val a = 5 -class A { - val b = a -} \ No newline at end of file diff --git a/idea/testData/quickfix/variables/changeToPropertyName/inaccessibleBackingFieldQualified.kt b/idea/testData/quickfix/variables/changeToPropertyName/inaccessibleBackingFieldQualified.kt deleted file mode 100644 index bee9f5aa95c..00000000000 --- a/idea/testData/quickfix/variables/changeToPropertyName/inaccessibleBackingFieldQualified.kt +++ /dev/null @@ -1,6 +0,0 @@ -// "Change '$a' to 'a'" "true" -package foo -val a = 5 -class A { - val b = foo.$a -} \ No newline at end of file diff --git a/idea/testData/quickfix/variables/changeToPropertyName/inaccessibleBackingFieldQualified.kt.after b/idea/testData/quickfix/variables/changeToPropertyName/inaccessibleBackingFieldQualified.kt.after deleted file mode 100644 index f2d63c65187..00000000000 --- a/idea/testData/quickfix/variables/changeToPropertyName/inaccessibleBackingFieldQualified.kt.after +++ /dev/null @@ -1,6 +0,0 @@ -// "Change '$a' to 'a'" "true" -package foo -val a = 5 -class A { - val b = foo.a -} \ No newline at end of file diff --git a/idea/testData/refactoring/rename/simpleNameReference/renameField.kt b/idea/testData/refactoring/rename/simpleNameReference/renameField.kt index feb5edac789..38121837b31 100644 --- a/idea/testData/refactoring/rename/simpleNameReference/renameField.kt +++ b/idea/testData/refactoring/rename/simpleNameReference/renameField.kt @@ -1,6 +1,6 @@ class aClass(){ var myField: Int = 0; set(value){ - $myField=value + field=value } } \ No newline at end of file diff --git a/idea/testData/refactoring/rename/simpleNameReference/renameField.kt.after b/idea/testData/refactoring/rename/simpleNameReference/renameField.kt.after index c8cb7b14090..e1a0d65a11c 100644 --- a/idea/testData/refactoring/rename/simpleNameReference/renameField.kt.after +++ b/idea/testData/refactoring/rename/simpleNameReference/renameField.kt.after @@ -1,6 +1,6 @@ class aClass(){ var renamed: Int = 0; set(value){ - $renamed =value + field=value } } \ No newline at end of file diff --git a/idea/testData/refactoring/rename/simpleNameReference/renameFieldIdentifier.kt b/idea/testData/refactoring/rename/simpleNameReference/renameFieldIdentifier.kt index 63e1ba5901e..72bb892f67f 100644 --- a/idea/testData/refactoring/rename/simpleNameReference/renameFieldIdentifier.kt +++ b/idea/testData/refactoring/rename/simpleNameReference/renameFieldIdentifier.kt @@ -1,6 +1,6 @@ class aClass(){ var myField: Int = 0; set(value){ - $myField=value + field=value } } \ No newline at end of file diff --git a/idea/testData/refactoring/rename/simpleNameReference/renameFieldIdentifier.kt.after b/idea/testData/refactoring/rename/simpleNameReference/renameFieldIdentifier.kt.after index 8cb996ea60b..45a79136cc4 100644 --- a/idea/testData/refactoring/rename/simpleNameReference/renameFieldIdentifier.kt.after +++ b/idea/testData/refactoring/rename/simpleNameReference/renameFieldIdentifier.kt.after @@ -1,6 +1,6 @@ class aClass(){ var anotherRenamed: Int = 0; set(value){ - $anotherRenamed =value + field=value } } \ No newline at end of file diff --git a/idea/tests/org/jetbrains/kotlin/checkers/JetPsiCheckerTestGenerated.java b/idea/tests/org/jetbrains/kotlin/checkers/JetPsiCheckerTestGenerated.java index 05f7c1c29d7..c054eca6833 100644 --- a/idea/tests/org/jetbrains/kotlin/checkers/JetPsiCheckerTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/checkers/JetPsiCheckerTestGenerated.java @@ -442,12 +442,6 @@ public class JetPsiCheckerTestGenerated extends AbstractJetPsiCheckerTest { doTest(fileName); } - @TestMetadata("Jet17.kt") - public void testJet17() throws Exception { - String fileName = JetTestUtils.navigationMetadata("idea/testData/checker/regression/Jet17.kt"); - doTest(fileName); - } - @TestMetadata("Jet183.kt") public void testJet183() throws Exception { String fileName = JetTestUtils.navigationMetadata("idea/testData/checker/regression/Jet183.kt"); diff --git a/idea/tests/org/jetbrains/kotlin/idea/quickfix/QuickFixTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/quickfix/QuickFixTestGenerated.java index a71ead9d6aa..9b6a16073f0 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/quickfix/QuickFixTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/idea/quickfix/QuickFixTestGenerated.java @@ -4250,33 +4250,6 @@ public class QuickFixTestGenerated extends AbstractQuickFixTest { } } - @TestMetadata("idea/testData/quickfix/migration/backingFieldSyntax") - @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class BackingFieldSyntax extends AbstractQuickFixTest { - @TestMetadata("accessor.kt") - public void testAccessor() throws Exception { - String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/migration/backingFieldSyntax/accessor.kt"); - doTest(fileName); - } - - public void testAllFilesPresentInBackingFieldSyntax() throws Exception { - JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/quickfix/migration/backingFieldSyntax"), Pattern.compile("^([\\w\\-_]+)\\.kt$"), true); - } - - @TestMetadata("introduceBackingField.kt") - public void testIntroduceBackingField() throws Exception { - String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/migration/backingFieldSyntax/introduceBackingField.kt"); - doTest(fileName); - } - - @TestMetadata("usage.kt") - public void testUsage() throws Exception { - String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/migration/backingFieldSyntax/usage.kt"); - doTest(fileName); - } - } - @TestMetadata("idea/testData/quickfix/migration/conflictingExtension") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) @@ -6792,45 +6765,6 @@ public class QuickFixTestGenerated extends AbstractQuickFixTest { } } - @TestMetadata("idea/testData/quickfix/variables/changeToPropertyName") - @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class ChangeToPropertyName extends AbstractQuickFixTest { - @TestMetadata("abstractProperty.kt") - public void testAbstractProperty() throws Exception { - String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/variables/changeToPropertyName/abstractProperty.kt"); - doTest(fileName); - } - - @TestMetadata("abstractPropertyThis.kt") - public void testAbstractPropertyThis() throws Exception { - String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/variables/changeToPropertyName/abstractPropertyThis.kt"); - doTest(fileName); - } - - public void testAllFilesPresentInChangeToPropertyName() throws Exception { - JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/quickfix/variables/changeToPropertyName"), Pattern.compile("^([\\w\\-_]+)\\.kt$"), true); - } - - @TestMetadata("customAccessors.kt") - public void testCustomAccessors() throws Exception { - String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/variables/changeToPropertyName/customAccessors.kt"); - doTest(fileName); - } - - @TestMetadata("inaccessibleBackingField.kt") - public void testInaccessibleBackingField() throws Exception { - String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/variables/changeToPropertyName/inaccessibleBackingField.kt"); - doTest(fileName); - } - - @TestMetadata("inaccessibleBackingFieldQualified.kt") - public void testInaccessibleBackingFieldQualified() throws Exception { - String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/variables/changeToPropertyName/inaccessibleBackingFieldQualified.kt"); - doTest(fileName); - } - } - @TestMetadata("idea/testData/quickfix/variables/removeValVarFromParameter") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/js/js.translator/src/org/jetbrains/kotlin/js/translate/reference/ReferenceTranslator.java b/js/js.translator/src/org/jetbrains/kotlin/js/translate/reference/ReferenceTranslator.java index a26a9fbf78a..237912254bc 100644 --- a/js/js.translator/src/org/jetbrains/kotlin/js/translate/reference/ReferenceTranslator.java +++ b/js/js.translator/src/org/jetbrains/kotlin/js/translate/reference/ReferenceTranslator.java @@ -103,7 +103,7 @@ public final class ReferenceTranslator { public static AccessTranslator getAccessTranslator(@NotNull KtSimpleNameExpression referenceExpression, @Nullable JsExpression receiver, @NotNull TranslationContext context) { - if (isBackingFieldReference(referenceExpression, getDescriptorForReferenceExpression(context.bindingContext(), referenceExpression))) { + if (isBackingFieldReference(getDescriptorForReferenceExpression(context.bindingContext(), referenceExpression))) { return BackingFieldAccessTranslator.newInstance(referenceExpression, context); } if (canBePropertyAccess(referenceExpression, context)) {