Get rid of FIELD_IDENTIFIER at syntax level, two errors dropped, a set of tests fixed / deleted #KT-9539 Fixed
This commit is contained in:
@@ -2007,9 +2007,7 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean directToField =
|
boolean directToField = isSyntheticField && contextKind() != OwnerKind.DEFAULT_IMPLS;
|
||||||
(expression.getReferencedNameElementType() == KtTokens.FIELD_IDENTIFIER || isSyntheticField)
|
|
||||||
&& contextKind() != OwnerKind.DEFAULT_IMPLS;
|
|
||||||
KtSuperExpression superExpression =
|
KtSuperExpression superExpression =
|
||||||
resolvedCall == null ? null : CallResolverUtilKt.getSuperCallExpression(resolvedCall.getCall());
|
resolvedCall == null ? null : CallResolverUtilKt.getSuperCallExpression(resolvedCall.getCall());
|
||||||
propertyDescriptor = context.accessibleDescriptor(propertyDescriptor, superExpression);
|
propertyDescriptor = context.accessibleDescriptor(propertyDescriptor, superExpression);
|
||||||
|
|||||||
@@ -402,7 +402,7 @@ public class JetFlowInformationProvider {
|
|||||||
) {
|
) {
|
||||||
VariableDescriptor variableDescriptor = ctxt.variableDescriptor;
|
VariableDescriptor variableDescriptor = ctxt.variableDescriptor;
|
||||||
PropertyDescriptor propertyDescriptor = SyntheticFieldDescriptorKt.getReferencedProperty(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);
|
KtPropertyAccessor accessor = PsiTreeUtil.getParentOfType(expression, KtPropertyAccessor.class);
|
||||||
if (accessor != null) {
|
if (accessor != null) {
|
||||||
DeclarationDescriptor accessorDescriptor = trace.get(BindingContext.DECLARATION_TO_DESCRIPTOR, accessor);
|
DeclarationDescriptor accessorDescriptor = trace.get(BindingContext.DECLARATION_TO_DESCRIPTOR, accessor);
|
||||||
@@ -511,11 +511,8 @@ public class JetFlowInformationProvider {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (variable instanceof KtSimpleNameExpression) {
|
if (variable instanceof KtSimpleNameExpression) {
|
||||||
KtSimpleNameExpression simpleNameExpression = (KtSimpleNameExpression) variable;
|
trace.record(IS_UNINITIALIZED, (PropertyDescriptor) variableDescriptor);
|
||||||
if (simpleNameExpression.getReferencedNameElementType() != KtTokens.FIELD_IDENTIFIER) {
|
return true;
|
||||||
trace.record(IS_UNINITIALIZED, (PropertyDescriptor) variableDescriptor);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -551,9 +548,6 @@ public class JetFlowInformationProvider {
|
|||||||
DeclarationDescriptor containingDeclaration = variableDescriptor.getContainingDeclaration();
|
DeclarationDescriptor containingDeclaration = variableDescriptor.getContainingDeclaration();
|
||||||
if ((containingDeclaration instanceof ClassDescriptor)
|
if ((containingDeclaration instanceof ClassDescriptor)
|
||||||
&& DescriptorUtils.isAncestor(containingDeclaration, declarationDescriptor, false)) {
|
&& DescriptorUtils.isAncestor(containingDeclaration, declarationDescriptor, false)) {
|
||||||
if (element instanceof KtSimpleNameExpression) {
|
|
||||||
report(Errors.BACKING_FIELD_USAGE_FORBIDDEN.on((KtSimpleNameExpression) element), cxtx);
|
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
report(Errors.INACCESSIBLE_BACKING_FIELD.on(element), cxtx);
|
report(Errors.INACCESSIBLE_BACKING_FIELD.on(element), cxtx);
|
||||||
@@ -567,9 +561,6 @@ public class JetFlowInformationProvider {
|
|||||||
boolean reportError
|
boolean reportError
|
||||||
) {
|
) {
|
||||||
error[0] = false;
|
error[0] = false;
|
||||||
if (KtPsiUtil.isBackingFieldReference(element, null)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (element instanceof KtDotQualifiedExpression && isCorrectBackingFieldReference(
|
if (element instanceof KtDotQualifiedExpression && isCorrectBackingFieldReference(
|
||||||
((KtDotQualifiedExpression) element).getSelectorExpression(), ctxt, error, false)) {
|
((KtDotQualifiedExpression) element).getSelectorExpression(), ctxt, error, false)) {
|
||||||
if (((KtDotQualifiedExpression) element).getReceiverExpression() instanceof KtThisExpression) {
|
if (((KtDotQualifiedExpression) element).getReceiverExpression() instanceof KtThisExpression) {
|
||||||
|
|||||||
@@ -361,9 +361,6 @@ public interface Errors {
|
|||||||
DiagnosticFactory0<KtProperty> PRIVATE_PROPERTY_IN_INTERFACE = DiagnosticFactory0.create(ERROR, PRIVATE_MODIFIER);
|
DiagnosticFactory0<KtProperty> PRIVATE_PROPERTY_IN_INTERFACE = DiagnosticFactory0.create(ERROR, PRIVATE_MODIFIER);
|
||||||
DiagnosticFactory0<KtProperty> BACKING_FIELD_IN_INTERFACE = DiagnosticFactory0.create(ERROR, DECLARATION_SIGNATURE);
|
DiagnosticFactory0<KtProperty> BACKING_FIELD_IN_INTERFACE = DiagnosticFactory0.create(ERROR, DECLARATION_SIGNATURE);
|
||||||
|
|
||||||
DiagnosticFactory0<KtSimpleNameExpression> BACKING_FIELD_OLD_SYNTAX = DiagnosticFactory0.create(ERROR);
|
|
||||||
DiagnosticFactory0<KtSimpleNameExpression> BACKING_FIELD_USAGE_FORBIDDEN = DiagnosticFactory0.create(ERROR);
|
|
||||||
|
|
||||||
DiagnosticFactory1<PsiElement, String> INAPPLICABLE_LATEINIT_MODIFIER = DiagnosticFactory1.create(ERROR);
|
DiagnosticFactory1<PsiElement, String> INAPPLICABLE_LATEINIT_MODIFIER = DiagnosticFactory1.create(ERROR);
|
||||||
|
|
||||||
DiagnosticFactory2<KtModifierListOwner, String, ClassDescriptor> ABSTRACT_PROPERTY_IN_NON_ABSTRACT_CLASS = DiagnosticFactory2.create(ERROR, ABSTRACT_MODIFIER);
|
DiagnosticFactory2<KtModifierListOwner, String, ClassDescriptor> ABSTRACT_PROPERTY_IN_NON_ABSTRACT_CLASS = DiagnosticFactory2.create(ERROR, ABSTRACT_MODIFIER);
|
||||||
|
|||||||
-3
@@ -170,9 +170,6 @@ public class DefaultErrorMessages {
|
|||||||
MAP.put(INACCESSIBLE_BACKING_FIELD, "The backing field is not accessible here");
|
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(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(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(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);
|
MAP.put(NAMED_PARAMETER_NOT_FOUND, "Cannot find a parameter with this name: {0}", ELEMENT_TEXT);
|
||||||
|
|||||||
@@ -106,7 +106,6 @@ public class JetExpressionParsing extends AbstractJetParsing {
|
|||||||
DO_KEYWORD,
|
DO_KEYWORD,
|
||||||
|
|
||||||
IDENTIFIER, // SimpleName
|
IDENTIFIER, // SimpleName
|
||||||
FIELD_IDENTIFIER, // Field reference
|
|
||||||
|
|
||||||
PACKAGE_KEYWORD, // for absolute qualified names
|
PACKAGE_KEYWORD, // for absolute qualified names
|
||||||
AT // Just for better recovery and maybe for annotations
|
AT // Just for better recovery and maybe for annotations
|
||||||
@@ -679,9 +678,6 @@ public class JetExpressionParsing extends AbstractJetParsing {
|
|||||||
VAR_KEYWORD, TYPE_ALIAS_KEYWORD)) {
|
VAR_KEYWORD, TYPE_ALIAS_KEYWORD)) {
|
||||||
parseLocalDeclaration();
|
parseLocalDeclaration();
|
||||||
}
|
}
|
||||||
else if (at(FIELD_IDENTIFIER)) {
|
|
||||||
parseSimpleNameExpression();
|
|
||||||
}
|
|
||||||
else if (at(IDENTIFIER)) {
|
else if (at(IDENTIFIER)) {
|
||||||
parseSimpleNameExpression();
|
parseSimpleNameExpression();
|
||||||
}
|
}
|
||||||
@@ -1019,12 +1015,7 @@ public class JetExpressionParsing extends AbstractJetParsing {
|
|||||||
*/
|
*/
|
||||||
public void parseSimpleNameExpression() {
|
public void parseSimpleNameExpression() {
|
||||||
PsiBuilder.Marker simpleName = mark();
|
PsiBuilder.Marker simpleName = mark();
|
||||||
if (at(FIELD_IDENTIFIER)) {
|
expect(IDENTIFIER, "Expecting an identifier");
|
||||||
advance(); //
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
expect(IDENTIFIER, "Expecting an identifier");
|
|
||||||
}
|
|
||||||
simpleName.done(REFERENCE_EXPRESSION);
|
simpleName.done(REFERENCE_EXPRESSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -64,6 +64,6 @@ public class KtNameReferenceExpression : KtExpressionImplStub<KotlinNameReferenc
|
|||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private val NAME_REFERENCE_EXPRESSIONS = TokenSet.create(IDENTIFIER, FIELD_IDENTIFIER, THIS_KEYWORD, SUPER_KEYWORD)
|
private val NAME_REFERENCE_EXPRESSIONS = TokenSet.create(IDENTIFIER, THIS_KEYWORD, SUPER_KEYWORD)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -361,12 +361,8 @@ public class KtPsiUtil {
|
|||||||
return declaration.getBodyExpression() == null;
|
return declaration.getBodyExpression() == null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isBackingFieldReference(@NotNull KtSimpleNameExpression expression, @Nullable DeclarationDescriptor descriptor) {
|
public static boolean isBackingFieldReference(@Nullable DeclarationDescriptor descriptor) {
|
||||||
return descriptor instanceof SyntheticFieldDescriptor || expression.getReferencedNameElementType() == KtTokens.FIELD_IDENTIFIER;
|
return descriptor instanceof SyntheticFieldDescriptor;
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isBackingFieldReference(@Nullable KtElement element, @Nullable DeclarationDescriptor descriptor) {
|
|
||||||
return element instanceof KtSimpleNameExpression && isBackingFieldReference((KtSimpleNameExpression) element, descriptor);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
|
|||||||
@@ -669,18 +669,8 @@ public class BodyResolver {
|
|||||||
return new ObservableBindingTrace(trace).addHandler(BindingContext.REFERENCE_TARGET, new ObservableBindingTrace.RecordHandler<KtReferenceExpression, DeclarationDescriptor>() {
|
return new ObservableBindingTrace(trace).addHandler(BindingContext.REFERENCE_TARGET, new ObservableBindingTrace.RecordHandler<KtReferenceExpression, DeclarationDescriptor>() {
|
||||||
@Override
|
@Override
|
||||||
public void handleRecord(WritableSlice<KtReferenceExpression, DeclarationDescriptor> slice, KtReferenceExpression expression, DeclarationDescriptor descriptor) {
|
public void handleRecord(WritableSlice<KtReferenceExpression, DeclarationDescriptor> slice, KtReferenceExpression expression, DeclarationDescriptor descriptor) {
|
||||||
if (expression instanceof KtSimpleNameExpression) {
|
if (expression instanceof KtSimpleNameExpression && descriptor instanceof SyntheticFieldDescriptor) {
|
||||||
KtSimpleNameExpression simpleNameExpression = (KtSimpleNameExpression) expression;
|
trace.record(BindingContext.BACKING_FIELD_REQUIRED, propertyDescriptor);
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -141,14 +141,7 @@ public class CallResolver {
|
|||||||
assert calleeExpression instanceof KtSimpleNameExpression;
|
assert calleeExpression instanceof KtSimpleNameExpression;
|
||||||
KtSimpleNameExpression nameExpression = (KtSimpleNameExpression) calleeExpression;
|
KtSimpleNameExpression nameExpression = (KtSimpleNameExpression) calleeExpression;
|
||||||
Name referencedName = nameExpression.getReferencedNameAsName();
|
Name referencedName = nameExpression.getReferencedNameAsName();
|
||||||
CallableDescriptorCollectors<VariableDescriptor> callableDescriptorCollectors;
|
CallableDescriptorCollectors<VariableDescriptor> callableDescriptorCollectors = CallableDescriptorCollectors.VARIABLES;
|
||||||
if (nameExpression.getReferencedNameElementType() == KtTokens.FIELD_IDENTIFIER) {
|
|
||||||
referencedName = Name.identifier(referencedName.asString().substring(1));
|
|
||||||
callableDescriptorCollectors = CallableDescriptorCollectors.PROPERTIES;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
callableDescriptorCollectors = CallableDescriptorCollectors.VARIABLES;
|
|
||||||
}
|
|
||||||
return computeTasksAndResolveCall(
|
return computeTasksAndResolveCall(
|
||||||
context, referencedName, nameExpression,
|
context, referencedName, nameExpression,
|
||||||
callableDescriptorCollectors, CallTransformer.VARIABLE_CALL_TRANSFORMER);
|
callableDescriptorCollectors, CallTransformer.VARIABLE_CALL_TRANSFORMER);
|
||||||
|
|||||||
+23
-23
@@ -3,52 +3,52 @@ fun foo() {
|
|||||||
class A {
|
class A {
|
||||||
var a : Int
|
var a : Int
|
||||||
get() {
|
get() {
|
||||||
return $a
|
return field
|
||||||
}
|
}
|
||||||
set(v: Int) {
|
set(v: Int) {
|
||||||
$a = v
|
field = v
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
---------------------
|
---------------------
|
||||||
L0:
|
L0:
|
||||||
1 <START> INIT: in: {} out: {} USE: in: {} out: {}
|
1 <START> INIT: in: {} out: {}
|
||||||
2 mark({ class A { var a : Int get() { return $a } set(v: Int) { $a = v } } })
|
2 mark({ class A { var a : Int get() { return field } set(v: Int) { field = v } } })
|
||||||
v(var a : Int get() { return $a } set(v: Int) { $a = v }) INIT: in: {} out: {a=D}
|
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}
|
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 $a }) USE: in: {a=READ} out: {a=READ}
|
d(get() { return field }) USE: in: {field=READ} out: {field=READ}
|
||||||
L2 [after local declaration]:
|
L2 [after local declaration]:
|
||||||
jmp?(L5)
|
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:
|
L1:
|
||||||
L5 [after local declaration]:
|
L5 [after local declaration]:
|
||||||
1 <END> INIT: in: {} out: {}
|
1 <END> INIT: in: {} out: {}
|
||||||
error:
|
error:
|
||||||
<ERROR>
|
<ERROR>
|
||||||
sink:
|
sink:
|
||||||
<SINK> USE: in: {} out: {}
|
<SINK> USE: in: {} out: {}
|
||||||
=====================
|
=====================
|
||||||
== get_a ==
|
== get_a ==
|
||||||
get() {
|
get() {
|
||||||
return $a
|
return field
|
||||||
}
|
}
|
||||||
---------------------
|
---------------------
|
||||||
L3:
|
L3:
|
||||||
3 <START> INIT: in: {} out: {}
|
3 <START> INIT: in: {} out: {}
|
||||||
4 mark({ return $a })
|
4 mark({ return field })
|
||||||
magic[IMPLICIT_RECEIVER]($a) -> <v0> USE: in: {a=READ} out: {a=READ}
|
magic[IMPLICIT_RECEIVER](field) -> <v0> USE: in: {field=READ} out: {field=READ}
|
||||||
r($a, a|<v0>) -> <v1> USE: in: {} out: {a=READ}
|
r(field|<v0>) -> <v1> USE: in: {} out: {field=READ}
|
||||||
ret(*|<v1>) L4
|
ret(*|<v1>) L4
|
||||||
L4:
|
L4:
|
||||||
3 <END>
|
3 <END>
|
||||||
error:
|
error:
|
||||||
<ERROR>
|
<ERROR>
|
||||||
sink:
|
sink:
|
||||||
<SINK> USE: in: {} out: {}
|
<SINK> USE: in: {} out: {}
|
||||||
=====================
|
=====================
|
||||||
== set_a ==
|
== set_a ==
|
||||||
set(v: Int) {
|
set(v: Int) {
|
||||||
$a = v
|
field = v
|
||||||
}
|
}
|
||||||
---------------------
|
---------------------
|
||||||
L6:
|
L6:
|
||||||
@@ -56,14 +56,14 @@ L6:
|
|||||||
v(v: Int) INIT: in: {} out: {v=D}
|
v(v: Int) INIT: in: {} out: {v=D}
|
||||||
magic[FAKE_INITIALIZER](v: Int) -> <v0> INIT: in: {v=D} out: {v=D}
|
magic[FAKE_INITIALIZER](v: Int) -> <v0> INIT: in: {v=D} out: {v=D}
|
||||||
w(v|<v0>) INIT: in: {v=D} out: {v=ID}
|
w(v|<v0>) INIT: in: {v=D} out: {v=ID}
|
||||||
4 mark({ $a = v }) INIT: in: {v=ID} out: {v=ID}
|
4 mark({ field = v }) INIT: in: {v=ID} out: {v=ID}
|
||||||
magic[IMPLICIT_RECEIVER]($a) -> <v1> USE: in: {a=ONLY_WRITTEN_NEVER_READ, v=READ} out: {a=ONLY_WRITTEN_NEVER_READ, v=READ}
|
magic[IMPLICIT_RECEIVER](field) -> <v1> USE: in: {field=ONLY_WRITTEN_NEVER_READ, v=READ} out: {field=ONLY_WRITTEN_NEVER_READ, v=READ}
|
||||||
r(v) -> <v2> USE: in: {a=ONLY_WRITTEN_NEVER_READ} out: {a=ONLY_WRITTEN_NEVER_READ, v=READ}
|
r(v) -> <v2> USE: in: {field=ONLY_WRITTEN_NEVER_READ} out: {field=ONLY_WRITTEN_NEVER_READ, v=READ}
|
||||||
w($a|<v1>, <v2>) INIT: in: {v=ID} out: {a=I, v=ID} USE: in: {} out: {a=ONLY_WRITTEN_NEVER_READ}
|
w(field|<v1>, <v2>) INIT: in: {v=ID} out: {field=I, v=ID} USE: in: {} out: {field=ONLY_WRITTEN_NEVER_READ}
|
||||||
L7:
|
L7:
|
||||||
3 <END> INIT: in: {a=I, v=ID} out: {a=I, v=ID}
|
3 <END> INIT: in: {field=I, v=ID} out: {field=I, v=ID}
|
||||||
error:
|
error:
|
||||||
<ERROR> INIT: in: {} out: {}
|
<ERROR> INIT: in: {} out: {}
|
||||||
sink:
|
sink:
|
||||||
<SINK> INIT: in: {a=I, v=ID} out: {a=I, v=ID} USE: in: {} out: {}
|
<SINK> INIT: in: {field=I, v=ID} out: {field=I, v=ID} USE: in: {} out: {}
|
||||||
=====================
|
=====================
|
||||||
@@ -2,10 +2,10 @@ fun foo() {
|
|||||||
class A {
|
class A {
|
||||||
var a : Int
|
var a : Int
|
||||||
get() {
|
get() {
|
||||||
return $a
|
return field
|
||||||
}
|
}
|
||||||
set(v: Int) {
|
set(v: Int) {
|
||||||
$a = v
|
field = v
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+13
-13
@@ -3,10 +3,10 @@ fun foo() {
|
|||||||
class A {
|
class A {
|
||||||
var a : Int
|
var a : Int
|
||||||
get() {
|
get() {
|
||||||
return $a
|
return field
|
||||||
}
|
}
|
||||||
set(v: Int) {
|
set(v: Int) {
|
||||||
$a = v
|
field = v
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -14,22 +14,22 @@ fun foo() {
|
|||||||
=====================
|
=====================
|
||||||
== get_a ==
|
== get_a ==
|
||||||
get() {
|
get() {
|
||||||
return $a
|
return field
|
||||||
}
|
}
|
||||||
---------------------
|
---------------------
|
||||||
<v0>: A NEW: magic[IMPLICIT_RECEIVER]($a) -> <v0>
|
<v0>: A NEW: magic[IMPLICIT_RECEIVER](field) -> <v0>
|
||||||
$a <v1>: Int NEW: r($a, a|<v0>) -> <v1>
|
field <v1>: Int NEW: r(field|<v0>) -> <v1>
|
||||||
return $a !<v2>: *
|
return field !<v2>: *
|
||||||
{ return $a } !<v2>: * COPY
|
{ return field } !<v2>: * COPY
|
||||||
=====================
|
=====================
|
||||||
== set_a ==
|
== set_a ==
|
||||||
set(v: Int) {
|
set(v: Int) {
|
||||||
$a = v
|
field = v
|
||||||
}
|
}
|
||||||
---------------------
|
---------------------
|
||||||
<v0>: Int NEW: magic[FAKE_INITIALIZER](v: Int) -> <v0>
|
<v0>: Int NEW: magic[FAKE_INITIALIZER](v: Int) -> <v0>
|
||||||
<v1>: A NEW: magic[IMPLICIT_RECEIVER]($a) -> <v1>
|
<v1>: A NEW: magic[IMPLICIT_RECEIVER](field) -> <v1>
|
||||||
v <v2>: Int NEW: r(v) -> <v2>
|
v <v2>: Int NEW: r(v) -> <v2>
|
||||||
$a = v !<v3>: *
|
field = v !<v3>: *
|
||||||
{ $a = v } !<v3>: * COPY
|
{ field = v } !<v3>: * COPY
|
||||||
=====================
|
=====================
|
||||||
|
|||||||
+11
-11
@@ -4,14 +4,14 @@ class AnonymousInitializers() {
|
|||||||
|
|
||||||
val i: Int
|
val i: Int
|
||||||
init {
|
init {
|
||||||
$i = 12
|
i = 12
|
||||||
}
|
}
|
||||||
|
|
||||||
val j: Int
|
val j: Int
|
||||||
get() = 20
|
get() = 20
|
||||||
|
|
||||||
init {
|
init {
|
||||||
$i = 13
|
i = 13
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
---------------------
|
---------------------
|
||||||
@@ -21,19 +21,19 @@ L0:
|
|||||||
r(34) -> <v0>
|
r(34) -> <v0>
|
||||||
w(k|<v0>)
|
w(k|<v0>)
|
||||||
v(val i: Int)
|
v(val i: Int)
|
||||||
2 mark({ $i = 12 })
|
2 mark({ i = 12 })
|
||||||
magic[IMPLICIT_RECEIVER]($i) -> <v1>
|
magic[IMPLICIT_RECEIVER](i) -> <v1>
|
||||||
r(12) -> <v2>
|
r(12) -> <v2>
|
||||||
w($i|<v1>, <v2>)
|
w(i|<v1>, <v2>)
|
||||||
1 v(val j: Int get() = 20)
|
1 v(val j: Int get() = 20)
|
||||||
2 mark({ $i = 13 })
|
2 mark({ i = 13 })
|
||||||
magic[IMPLICIT_RECEIVER]($i) -> <v4>
|
magic[IMPLICIT_RECEIVER](i) -> <v4>
|
||||||
r(13) -> <v5>
|
r(13) -> <v5>
|
||||||
w($i|<v4>, <v5>)
|
w(i|<v4>, <v5>)
|
||||||
L1:
|
L1:
|
||||||
1 <END> NEXT:[<SINK>]
|
1 <END> NEXT:[<SINK>]
|
||||||
error:
|
error:
|
||||||
<ERROR> PREV:[]
|
<ERROR> PREV:[]
|
||||||
sink:
|
sink:
|
||||||
<SINK> PREV:[<ERROR>, <END>]
|
<SINK> PREV:[<ERROR>, <END>]
|
||||||
=====================
|
=====================
|
||||||
+2
-2
@@ -3,13 +3,13 @@ class AnonymousInitializers() {
|
|||||||
|
|
||||||
val i: Int
|
val i: Int
|
||||||
init {
|
init {
|
||||||
$i = 12
|
i = 12
|
||||||
}
|
}
|
||||||
|
|
||||||
val j: Int
|
val j: Int
|
||||||
get() = 20
|
get() = 20
|
||||||
|
|
||||||
init {
|
init {
|
||||||
$i = 13
|
i = 13
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+11
-11
@@ -4,24 +4,24 @@ class AnonymousInitializers() {
|
|||||||
|
|
||||||
val i: Int
|
val i: Int
|
||||||
init {
|
init {
|
||||||
$i = 12
|
i = 12
|
||||||
}
|
}
|
||||||
|
|
||||||
val j: Int
|
val j: Int
|
||||||
get() = 20
|
get() = 20
|
||||||
|
|
||||||
init {
|
init {
|
||||||
$i = 13
|
i = 13
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
---------------------
|
---------------------
|
||||||
<v1>: AnonymousInitializers NEW: magic[IMPLICIT_RECEIVER]($i) -> <v1>
|
<v1>: AnonymousInitializers NEW: magic[IMPLICIT_RECEIVER](i) -> <v1>
|
||||||
<v4>: AnonymousInitializers NEW: magic[IMPLICIT_RECEIVER]($i) -> <v4>
|
<v4>: AnonymousInitializers NEW: magic[IMPLICIT_RECEIVER](i) -> <v4>
|
||||||
34 <v0>: Int NEW: r(34) -> <v0>
|
34 <v0>: Int NEW: r(34) -> <v0>
|
||||||
12 <v2>: Int NEW: r(12) -> <v2>
|
12 <v2>: Int NEW: r(12) -> <v2>
|
||||||
$i = 12 !<v3>: *
|
i = 12 !<v3>: *
|
||||||
{ $i = 12 } !<v3>: * COPY
|
{ i = 12 } !<v3>: * COPY
|
||||||
13 <v5>: Int NEW: r(13) -> <v5>
|
13 <v5>: Int NEW: r(13) -> <v5>
|
||||||
$i = 13 !<v6>: *
|
i = 13 !<v6>: *
|
||||||
{ $i = 13 } !<v6>: * COPY
|
{ i = 13 } !<v6>: * COPY
|
||||||
=====================
|
=====================
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ class C() {
|
|||||||
val x : Int
|
val x : Int
|
||||||
|
|
||||||
init {
|
init {
|
||||||
$x = 1
|
x = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -51,51 +51,51 @@ fun test1() {
|
|||||||
val a = object {
|
val a = object {
|
||||||
val x : Int
|
val x : Int
|
||||||
init {
|
init {
|
||||||
$x = 1
|
x = 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
---------------------
|
---------------------
|
||||||
L0:
|
L0:
|
||||||
1 <START>
|
1 <START>
|
||||||
2 mark({ val a = 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 } })
|
v(val a = object { val x : Int init { x = 1 } })
|
||||||
mark(object { val x : Int init { $x = 1 } })
|
mark(object { val x : Int init { x = 1 } })
|
||||||
v(val x : Int)
|
v(val x : Int)
|
||||||
3 mark({ $x = 1 })
|
3 mark({ x = 1 })
|
||||||
magic[IMPLICIT_RECEIVER]($x) -> <v0>
|
magic[IMPLICIT_RECEIVER](x) -> <v0>
|
||||||
r(1) -> <v1>
|
r(1) -> <v1>
|
||||||
w($x|<v0>, <v1>)
|
w(x|<v0>, <v1>)
|
||||||
2 r(object { val x : Int init { $x = 1 } }) -> <v3>
|
2 r(object { val x : Int init { x = 1 } }) -> <v3>
|
||||||
w(a|<v3>)
|
w(a|<v3>)
|
||||||
L1:
|
L1:
|
||||||
1 <END> NEXT:[<SINK>]
|
1 <END> NEXT:[<SINK>]
|
||||||
error:
|
error:
|
||||||
<ERROR> PREV:[]
|
<ERROR> PREV:[]
|
||||||
sink:
|
sink:
|
||||||
<SINK> PREV:[<ERROR>, <END>]
|
<SINK> PREV:[<ERROR>, <END>]
|
||||||
=====================
|
=====================
|
||||||
== O ==
|
== O ==
|
||||||
object O {
|
object O {
|
||||||
val x : Int
|
val x : Int
|
||||||
init {
|
init {
|
||||||
$x = 1
|
x = 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
---------------------
|
---------------------
|
||||||
L0:
|
L0:
|
||||||
1 <START>
|
1 <START>
|
||||||
v(val x : Int)
|
v(val x : Int)
|
||||||
2 mark({ $x = 1 })
|
2 mark({ x = 1 })
|
||||||
magic[IMPLICIT_RECEIVER]($x) -> <v0>
|
magic[IMPLICIT_RECEIVER](x) -> <v0>
|
||||||
r(1) -> <v1>
|
r(1) -> <v1>
|
||||||
w($x|<v0>, <v1>)
|
w(x|<v0>, <v1>)
|
||||||
L1:
|
L1:
|
||||||
1 <END> NEXT:[<SINK>]
|
1 <END> NEXT:[<SINK>]
|
||||||
error:
|
error:
|
||||||
<ERROR> PREV:[]
|
<ERROR> PREV:[]
|
||||||
sink:
|
sink:
|
||||||
<SINK> PREV:[<ERROR>, <END>]
|
<SINK> PREV:[<ERROR>, <END>]
|
||||||
=====================
|
=====================
|
||||||
== test2 ==
|
== test2 ==
|
||||||
fun test2() {
|
fun test2() {
|
||||||
@@ -177,7 +177,7 @@ fun test4() {
|
|||||||
val x : Int
|
val x : Int
|
||||||
val y : Int
|
val y : Int
|
||||||
init {
|
init {
|
||||||
$x = 1
|
x = 1
|
||||||
}
|
}
|
||||||
fun ggg() {
|
fun ggg() {
|
||||||
y = 10
|
y = 10
|
||||||
@@ -187,26 +187,26 @@ fun test4() {
|
|||||||
---------------------
|
---------------------
|
||||||
L0:
|
L0:
|
||||||
1 <START>
|
1 <START>
|
||||||
2 mark({ val a = 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 } })
|
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 } })
|
mark(object { val x : Int val y : Int init { x = 1 } fun ggg() { y = 10 } })
|
||||||
v(val x : Int)
|
v(val x : Int)
|
||||||
v(val y : Int)
|
v(val y : Int)
|
||||||
3 mark({ $x = 1 })
|
3 mark({ x = 1 })
|
||||||
magic[IMPLICIT_RECEIVER]($x) -> <v0>
|
magic[IMPLICIT_RECEIVER](x) -> <v0>
|
||||||
r(1) -> <v1>
|
r(1) -> <v1>
|
||||||
w($x|<v0>, <v1>)
|
w(x|<v0>, <v1>)
|
||||||
2 jmp?(L2) NEXT:[r(object { val x : Int val y : Int init { $x = 1 } fun ggg() { y = 10 } }) -> <v3>, d(fun ggg() { y = 10 })]
|
2 jmp?(L2) NEXT:[r(object { val x : Int val y : Int init { x = 1 } fun ggg() { y = 10 } }) -> <v3>, d(fun ggg() { y = 10 })]
|
||||||
d(fun ggg() { y = 10 }) NEXT:[<SINK>]
|
d(fun ggg() { y = 10 }) NEXT:[<SINK>]
|
||||||
L2 [after local declaration]:
|
L2 [after local declaration]:
|
||||||
r(object { val x : Int val y : Int init { $x = 1 } fun ggg() { y = 10 } }) -> <v3> PREV:[jmp?(L2)]
|
r(object { val x : Int val y : Int init { x = 1 } fun ggg() { y = 10 } }) -> <v3> PREV:[jmp?(L2)]
|
||||||
w(a|<v3>)
|
w(a|<v3>)
|
||||||
L1:
|
L1:
|
||||||
1 <END> NEXT:[<SINK>]
|
1 <END> NEXT:[<SINK>]
|
||||||
error:
|
error:
|
||||||
<ERROR> PREV:[]
|
<ERROR> PREV:[]
|
||||||
sink:
|
sink:
|
||||||
<SINK> PREV:[<ERROR>, <END>, d(fun ggg() { y = 10 })]
|
<SINK> PREV:[<ERROR>, <END>, d(fun ggg() { y = 10 })]
|
||||||
=====================
|
=====================
|
||||||
== ggg ==
|
== ggg ==
|
||||||
fun ggg() {
|
fun ggg() {
|
||||||
@@ -231,7 +231,7 @@ fun test5() {
|
|||||||
val a = object {
|
val a = object {
|
||||||
var x = 1
|
var x = 1
|
||||||
init {
|
init {
|
||||||
$x = 2
|
x = 2
|
||||||
}
|
}
|
||||||
fun foo() {
|
fun foo() {
|
||||||
x = 3
|
x = 3
|
||||||
@@ -244,30 +244,30 @@ fun test5() {
|
|||||||
---------------------
|
---------------------
|
||||||
L0:
|
L0:
|
||||||
1 <START>
|
1 <START>
|
||||||
2 mark({ val a = 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 } })
|
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 } })
|
mark(object { var x = 1 init { x = 2 } fun foo() { x = 3 } fun bar() { x = 4 } })
|
||||||
v(var x = 1)
|
v(var x = 1)
|
||||||
r(1) -> <v0>
|
r(1) -> <v0>
|
||||||
w(x|<v0>)
|
w(x|<v0>)
|
||||||
3 mark({ $x = 2 })
|
3 mark({ x = 2 })
|
||||||
magic[IMPLICIT_RECEIVER]($x) -> <v1>
|
magic[IMPLICIT_RECEIVER](x) -> <v1>
|
||||||
r(2) -> <v2>
|
r(2) -> <v2>
|
||||||
w($x|<v1>, <v2>)
|
w(x|<v1>, <v2>)
|
||||||
2 jmp?(L2) NEXT:[jmp?(L5), d(fun foo() { x = 3 })]
|
2 jmp?(L2) NEXT:[jmp?(L5), d(fun foo() { x = 3 })]
|
||||||
d(fun foo() { x = 3 }) NEXT:[<SINK>]
|
d(fun foo() { x = 3 }) NEXT:[<SINK>]
|
||||||
L2 [after local declaration]:
|
L2 [after local declaration]:
|
||||||
jmp?(L5) NEXT:[r(object { var x = 1 init { $x = 2 } fun foo() { x = 3 } fun bar() { x = 4 } }) -> <v4>, d(fun bar() { x = 4 })] PREV:[jmp?(L2)]
|
jmp?(L5) NEXT:[r(object { var x = 1 init { x = 2 } fun foo() { x = 3 } fun bar() { x = 4 } }) -> <v4>, d(fun bar() { x = 4 })] PREV:[jmp?(L2)]
|
||||||
d(fun bar() { x = 4 }) NEXT:[<SINK>]
|
d(fun bar() { x = 4 }) NEXT:[<SINK>]
|
||||||
L5 [after local declaration]:
|
L5 [after local declaration]:
|
||||||
r(object { var x = 1 init { $x = 2 } fun foo() { x = 3 } fun bar() { x = 4 } }) -> <v4> PREV:[jmp?(L5)]
|
r(object { var x = 1 init { x = 2 } fun foo() { x = 3 } fun bar() { x = 4 } }) -> <v4> PREV:[jmp?(L5)]
|
||||||
w(a|<v4>)
|
w(a|<v4>)
|
||||||
L1:
|
L1:
|
||||||
1 <END> NEXT:[<SINK>]
|
1 <END> NEXT:[<SINK>]
|
||||||
error:
|
error:
|
||||||
<ERROR> PREV:[]
|
<ERROR> PREV:[]
|
||||||
sink:
|
sink:
|
||||||
<SINK> PREV:[<ERROR>, <END>, d(fun foo() { x = 3 }), d(fun bar() { x = 4 })]
|
<SINK> PREV:[<ERROR>, <END>, d(fun foo() { x = 3 }), d(fun bar() { x = 4 })]
|
||||||
=====================
|
=====================
|
||||||
== foo ==
|
== foo ==
|
||||||
fun foo() {
|
fun foo() {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ class C() {
|
|||||||
val x : Int
|
val x : Int
|
||||||
|
|
||||||
init {
|
init {
|
||||||
$x = 1
|
x = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -22,7 +22,7 @@ fun test1() {
|
|||||||
val a = object {
|
val a = object {
|
||||||
val x : Int
|
val x : Int
|
||||||
init {
|
init {
|
||||||
$x = 1
|
x = 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -30,7 +30,7 @@ fun test1() {
|
|||||||
object O {
|
object O {
|
||||||
val x : Int
|
val x : Int
|
||||||
init {
|
init {
|
||||||
$x = 1
|
x = 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,7 +53,7 @@ fun test4() {
|
|||||||
val x : Int
|
val x : Int
|
||||||
val y : Int
|
val y : Int
|
||||||
init {
|
init {
|
||||||
$x = 1
|
x = 1
|
||||||
}
|
}
|
||||||
fun ggg() {
|
fun ggg() {
|
||||||
y = 10
|
y = 10
|
||||||
@@ -65,7 +65,7 @@ fun test5() {
|
|||||||
val a = object {
|
val a = object {
|
||||||
var x = 1
|
var x = 1
|
||||||
init {
|
init {
|
||||||
$x = 2
|
x = 2
|
||||||
}
|
}
|
||||||
fun foo() {
|
fun foo() {
|
||||||
x = 3
|
x = 3
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ class C() {
|
|||||||
val x : Int
|
val x : Int
|
||||||
|
|
||||||
init {
|
init {
|
||||||
$x = 1
|
x = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -29,29 +29,29 @@ fun test1() {
|
|||||||
val a = object {
|
val a = object {
|
||||||
val x : Int
|
val x : Int
|
||||||
init {
|
init {
|
||||||
$x = 1
|
x = 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
---------------------
|
---------------------
|
||||||
<v0>: <no name provided> NEW: magic[IMPLICIT_RECEIVER]($x) -> <v0>
|
<v0>: <no name provided> NEW: magic[IMPLICIT_RECEIVER](x) -> <v0>
|
||||||
1 <v1>: Int NEW: r(1) -> <v1>
|
1 <v1>: Int NEW: r(1) -> <v1>
|
||||||
$x = 1 !<v2>: *
|
x = 1 !<v2>: *
|
||||||
{ $x = 1 } !<v2>: * COPY
|
{ x = 1 } !<v2>: * COPY
|
||||||
object { val x : Int init { $x = 1 } } <v3>: <no name provided> NEW: r(object { val x : Int init { $x = 1 } }) -> <v3>
|
object { val x : Int init { x = 1 } } <v3>: <no name provided> NEW: r(object { val x : Int init { x = 1 } }) -> <v3>
|
||||||
=====================
|
=====================
|
||||||
== O ==
|
== O ==
|
||||||
object O {
|
object O {
|
||||||
val x : Int
|
val x : Int
|
||||||
init {
|
init {
|
||||||
$x = 1
|
x = 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
---------------------
|
---------------------
|
||||||
<v0>: O NEW: magic[IMPLICIT_RECEIVER]($x) -> <v0>
|
<v0>: O NEW: magic[IMPLICIT_RECEIVER](x) -> <v0>
|
||||||
1 <v1>: Int NEW: r(1) -> <v1>
|
1 <v1>: Int NEW: r(1) -> <v1>
|
||||||
$x = 1 !<v2>: *
|
x = 1 !<v2>: *
|
||||||
{ $x = 1 } !<v2>: * COPY
|
{ x = 1 } !<v2>: * COPY
|
||||||
=====================
|
=====================
|
||||||
== test2 ==
|
== test2 ==
|
||||||
fun test2() {
|
fun test2() {
|
||||||
@@ -93,7 +93,7 @@ fun test4() {
|
|||||||
val x : Int
|
val x : Int
|
||||||
val y : Int
|
val y : Int
|
||||||
init {
|
init {
|
||||||
$x = 1
|
x = 1
|
||||||
}
|
}
|
||||||
fun ggg() {
|
fun ggg() {
|
||||||
y = 10
|
y = 10
|
||||||
@@ -101,11 +101,11 @@ fun test4() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
---------------------
|
---------------------
|
||||||
<v0>: <no name provided> NEW: magic[IMPLICIT_RECEIVER]($x) -> <v0>
|
<v0>: <no name provided> NEW: magic[IMPLICIT_RECEIVER](x) -> <v0>
|
||||||
1 <v1>: Int NEW: r(1) -> <v1>
|
1 <v1>: Int NEW: r(1) -> <v1>
|
||||||
$x = 1 !<v2>: *
|
x = 1 !<v2>: *
|
||||||
{ $x = 1 } !<v2>: * COPY
|
{ x = 1 } !<v2>: * COPY
|
||||||
object { val x : Int val y : Int init { $x = 1 } fun ggg() { y = 10 } } <v3>: <no name provided> NEW: r(object { val x : Int val y : Int init { $x = 1 } fun ggg() { y = 10 } }) -> <v3>
|
object { val x : Int val y : Int init { x = 1 } fun ggg() { y = 10 } } <v3>: <no name provided> NEW: r(object { val x : Int val y : Int init { x = 1 } fun ggg() { y = 10 } }) -> <v3>
|
||||||
=====================
|
=====================
|
||||||
== ggg ==
|
== ggg ==
|
||||||
fun ggg() {
|
fun ggg() {
|
||||||
@@ -122,7 +122,7 @@ fun test5() {
|
|||||||
val a = object {
|
val a = object {
|
||||||
var x = 1
|
var x = 1
|
||||||
init {
|
init {
|
||||||
$x = 2
|
x = 2
|
||||||
}
|
}
|
||||||
fun foo() {
|
fun foo() {
|
||||||
x = 3
|
x = 3
|
||||||
@@ -133,12 +133,12 @@ fun test5() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
---------------------
|
---------------------
|
||||||
<v1>: <no name provided> NEW: magic[IMPLICIT_RECEIVER]($x) -> <v1>
|
<v1>: <no name provided> NEW: magic[IMPLICIT_RECEIVER](x) -> <v1>
|
||||||
1 <v0>: Int NEW: r(1) -> <v0>
|
1 <v0>: Int NEW: r(1) -> <v0>
|
||||||
2 <v2>: Int NEW: r(2) -> <v2>
|
2 <v2>: Int NEW: r(2) -> <v2>
|
||||||
$x = 2 !<v3>: *
|
x = 2 !<v3>: *
|
||||||
{ $x = 2 } !<v3>: * COPY
|
{ x = 2 } !<v3>: * COPY
|
||||||
object { var x = 1 init { $x = 2 } fun foo() { x = 3 } fun bar() { x = 4 } } <v4>: <no name provided> NEW: r(object { var x = 1 init { $x = 2 } fun foo() { x = 3 } fun bar() { x = 4 } }) -> <v4>
|
object { var x = 1 init { x = 2 } fun foo() { x = 3 } fun bar() { x = 4 } } <v4>: <no name provided> NEW: r(object { var x = 1 init { x = 2 } fun foo() { x = 3 } fun bar() { x = 4 } }) -> <v4>
|
||||||
=====================
|
=====================
|
||||||
== foo ==
|
== foo ==
|
||||||
fun foo() {
|
fun foo() {
|
||||||
|
|||||||
-23
@@ -1,23 +0,0 @@
|
|||||||
== C ==
|
|
||||||
class C {
|
|
||||||
val a: Int
|
|
||||||
get() = 1
|
|
||||||
|
|
||||||
init {
|
|
||||||
$a
|
|
||||||
}
|
|
||||||
}
|
|
||||||
---------------------
|
|
||||||
L0:
|
|
||||||
1 <START>
|
|
||||||
v(val a: Int get() = 1)
|
|
||||||
2 mark({ $a })
|
|
||||||
magic[IMPLICIT_RECEIVER]($a) -> <v0>
|
|
||||||
r($a, a|<v0>) -> <v1>
|
|
||||||
L1:
|
|
||||||
1 <END> NEXT:[<SINK>]
|
|
||||||
error:
|
|
||||||
<ERROR> PREV:[]
|
|
||||||
sink:
|
|
||||||
<SINK> PREV:[<ERROR>, <END>]
|
|
||||||
=====================
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
class C {
|
|
||||||
val a: Int
|
|
||||||
get() = 1
|
|
||||||
|
|
||||||
init {
|
|
||||||
$a
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
== C ==
|
|
||||||
class C {
|
|
||||||
val a: Int
|
|
||||||
get() = 1
|
|
||||||
|
|
||||||
init {
|
|
||||||
$a
|
|
||||||
}
|
|
||||||
}
|
|
||||||
---------------------
|
|
||||||
<v0>: C NEW: magic[IMPLICIT_RECEIVER]($a) -> <v0>
|
|
||||||
$a <v1>: * NEW: r($a, a|<v0>) -> <v1>
|
|
||||||
{ $a } <v1>: * COPY
|
|
||||||
=====================
|
|
||||||
-36
@@ -1,36 +0,0 @@
|
|||||||
== Bar ==
|
|
||||||
abstract class Bar {
|
|
||||||
abstract var bar : String
|
|
||||||
fun foo() = "foo" + this.$bar
|
|
||||||
}
|
|
||||||
---------------------
|
|
||||||
L0:
|
|
||||||
1 <START>
|
|
||||||
v(abstract var bar : String)
|
|
||||||
L1:
|
|
||||||
<END> NEXT:[<SINK>]
|
|
||||||
error:
|
|
||||||
<ERROR> PREV:[]
|
|
||||||
sink:
|
|
||||||
<SINK> PREV:[<ERROR>, <END>]
|
|
||||||
=====================
|
|
||||||
== foo ==
|
|
||||||
fun foo() = "foo" + this.$bar
|
|
||||||
---------------------
|
|
||||||
L0:
|
|
||||||
1 <START>
|
|
||||||
mark("foo")
|
|
||||||
r("foo") -> <v0>
|
|
||||||
mark(this.$bar)
|
|
||||||
r(this, <this>) -> <v1>
|
|
||||||
r($bar, bar|<v1>) -> <v2>
|
|
||||||
mark("foo" + this.$bar)
|
|
||||||
call("foo" + this.$bar, plus|<v0>, <v2>) -> <v3>
|
|
||||||
ret(*|<v3>) L1
|
|
||||||
L1:
|
|
||||||
<END> NEXT:[<SINK>]
|
|
||||||
error:
|
|
||||||
<ERROR> PREV:[]
|
|
||||||
sink:
|
|
||||||
<SINK> PREV:[<ERROR>, <END>]
|
|
||||||
=====================
|
|
||||||
-4
@@ -1,4 +0,0 @@
|
|||||||
abstract class Bar {
|
|
||||||
abstract var bar : String
|
|
||||||
fun foo() = "foo" + this.$bar
|
|
||||||
}
|
|
||||||
-17
@@ -1,17 +0,0 @@
|
|||||||
== Bar ==
|
|
||||||
abstract class Bar {
|
|
||||||
abstract var bar : String
|
|
||||||
fun foo() = "foo" + this.$bar
|
|
||||||
}
|
|
||||||
---------------------
|
|
||||||
=====================
|
|
||||||
== foo ==
|
|
||||||
fun foo() = "foo" + this.$bar
|
|
||||||
---------------------
|
|
||||||
"foo" <v0>: String NEW: r("foo") -> <v0>
|
|
||||||
this <v1>: {<: Bar} COPY
|
|
||||||
this <v1>: {<: Bar} NEW: r(this, <this>) -> <v1>
|
|
||||||
$bar <v2>: * NEW: r($bar, bar|<v1>) -> <v2>
|
|
||||||
this.$bar <v2>: * COPY
|
|
||||||
"foo" + this.$bar <v3>: String NEW: call("foo" + this.$bar, plus|<v0>, <v2>) -> <v3>
|
|
||||||
=====================
|
|
||||||
@@ -13,7 +13,6 @@ interface NoC {
|
|||||||
class WithC() {
|
class WithC() {
|
||||||
val x : Int = 1
|
val x : Int = 1
|
||||||
init {
|
init {
|
||||||
<!UNRESOLVED_REFERENCE!>$y<!> = 2
|
|
||||||
val <!UNUSED_VARIABLE!>b<!> = x
|
val <!UNUSED_VARIABLE!>b<!> = x
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -23,6 +22,5 @@ class WithC() {
|
|||||||
init {
|
init {
|
||||||
val <!UNUSED_VARIABLE!>z<!> = <!UNRESOLVED_REFERENCE!>b<!>
|
val <!UNUSED_VARIABLE!>z<!> = <!UNRESOLVED_REFERENCE!>b<!>
|
||||||
val <!UNUSED_VARIABLE!>zz<!> = x
|
val <!UNUSED_VARIABLE!>zz<!> = x
|
||||||
val <!UNUSED_VARIABLE!>zzz<!> = <!NO_BACKING_FIELD_CUSTOM_ACCESSORS!>$a<!>
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+3
-11
@@ -14,17 +14,9 @@ var x : Int = 1 + <!UNINITIALIZED_VARIABLE!>x<!>
|
|||||||
|
|
||||||
class Test() {
|
class Test() {
|
||||||
var a : Int = 111
|
var a : Int = 111
|
||||||
var b : Int get() = <!BACKING_FIELD_USAGE_FORBIDDEN!>$a<!>; set(x) {a = x; <!BACKING_FIELD_USAGE_FORBIDDEN!>$a<!> = x}
|
var b : Int = 222
|
||||||
|
get() = field
|
||||||
|
set(x) {a = x; field = x}
|
||||||
|
|
||||||
init {
|
|
||||||
<!NO_BACKING_FIELD_CUSTOM_ACCESSORS!>$b<!> = <!BACKING_FIELD_USAGE_FORBIDDEN!>$a<!>
|
|
||||||
<!BACKING_FIELD_USAGE_FORBIDDEN!>$a<!> = <!NO_BACKING_FIELD_CUSTOM_ACCESSORS!>$b<!>
|
|
||||||
a = <!NO_BACKING_FIELD_CUSTOM_ACCESSORS!>$b<!>
|
|
||||||
}
|
|
||||||
|
|
||||||
fun f() {
|
|
||||||
<!NO_BACKING_FIELD_CUSTOM_ACCESSORS!>$b<!> = <!BACKING_FIELD_USAGE_FORBIDDEN!>$a<!>
|
|
||||||
a = <!NO_BACKING_FIELD_CUSTOM_ACCESSORS!>$b<!>
|
|
||||||
}
|
|
||||||
public val i = 1
|
public val i = 1
|
||||||
}
|
}
|
||||||
@@ -10,7 +10,6 @@ public final class Test {
|
|||||||
public final var b: kotlin.Int
|
public final var b: kotlin.Int
|
||||||
public final val i: kotlin.Int = 1
|
public final val i: kotlin.Int = 1
|
||||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
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 hashCode(): kotlin.Int
|
||||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,9 +3,4 @@ class Flower() {
|
|||||||
var minusOne: Int = 1
|
var minusOne: Int = 1
|
||||||
get() = field + 1
|
get() = field + 1
|
||||||
set(n: Int) { field = n - 1 }
|
set(n: Int) { field = n - 1 }
|
||||||
|
|
||||||
var oldSyntax: Int = 1
|
|
||||||
get() = <!BACKING_FIELD_OLD_SYNTAX!>$oldSyntax<!> - 1
|
|
||||||
set(arg) { <!BACKING_FIELD_OLD_SYNTAX!>$oldSyntax<!> = arg + 1 }
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package
|
|||||||
public final class Flower {
|
public final class Flower {
|
||||||
public constructor Flower()
|
public constructor Flower()
|
||||||
public final var minusOne: kotlin.Int
|
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 equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
|||||||
-3
@@ -1,3 +0,0 @@
|
|||||||
class Cyclic() {
|
|
||||||
val a = <!TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM, UNINITIALIZED_VARIABLE!>$a<!>
|
|
||||||
}
|
|
||||||
-9
@@ -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
|
|
||||||
}
|
|
||||||
Vendored
-7
@@ -1,7 +0,0 @@
|
|||||||
abstract class ReadNonexistent() {
|
|
||||||
abstract val aa: Int
|
|
||||||
|
|
||||||
init {
|
|
||||||
val <!UNUSED_VARIABLE!>x<!> = <!NO_BACKING_FIELD_ABSTRACT_PROPERTY!>$aa<!>
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Vendored
-9
@@ -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
|
|
||||||
}
|
|
||||||
Vendored
-5
@@ -1,5 +0,0 @@
|
|||||||
abstract class ReadNonexistent {
|
|
||||||
abstract val aa: Int
|
|
||||||
|
|
||||||
fun ff() = <!NO_BACKING_FIELD_ABSTRACT_PROPERTY!>$aa<!>
|
|
||||||
}
|
|
||||||
Vendored
-10
@@ -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
|
|
||||||
}
|
|
||||||
-8
@@ -1,8 +0,0 @@
|
|||||||
class ReadNonexistent() {
|
|
||||||
val a: Int
|
|
||||||
get() = 1
|
|
||||||
|
|
||||||
init {
|
|
||||||
val <!UNUSED_VARIABLE!>x<!> = <!NO_BACKING_FIELD_CUSTOM_ACCESSORS!>$a<!>
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-9
@@ -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
|
|
||||||
}
|
|
||||||
Vendored
-6
@@ -1,6 +0,0 @@
|
|||||||
class CustomValNoBackingField() {
|
|
||||||
val a: Int
|
|
||||||
get() = 1
|
|
||||||
|
|
||||||
val b = <!NO_BACKING_FIELD_CUSTOM_ACCESSORS!>$a<!>
|
|
||||||
}
|
|
||||||
Vendored
-10
@@ -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
|
|
||||||
}
|
|
||||||
-6
@@ -1,6 +0,0 @@
|
|||||||
class CustomValNoBackingField() {
|
|
||||||
val a: Int
|
|
||||||
get() = 1
|
|
||||||
|
|
||||||
val b = <!NO_BACKING_FIELD_CUSTOM_ACCESSORS!>$a<!>
|
|
||||||
}
|
|
||||||
-10
@@ -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
|
|
||||||
}
|
|
||||||
-5
@@ -1,5 +0,0 @@
|
|||||||
class Cl() {
|
|
||||||
init {
|
|
||||||
val <!UNUSED_VARIABLE!>x<!> = <!UNRESOLVED_REFERENCE!>$a<!>
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-8
@@ -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
|
|
||||||
}
|
|
||||||
-7
@@ -1,7 +0,0 @@
|
|||||||
val y = 1
|
|
||||||
|
|
||||||
class A() {
|
|
||||||
init {
|
|
||||||
<!INACCESSIBLE_BACKING_FIELD!>$y<!> = 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-10
@@ -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
|
|
||||||
}
|
|
||||||
@@ -12,9 +12,5 @@ get() {
|
|||||||
val x : Int
|
val x : Int
|
||||||
get() = z
|
get() = z
|
||||||
|
|
||||||
val w : Int
|
val w : Int = 56
|
||||||
get() = <!INACCESSIBLE_BACKING_FIELD!>$z<!>
|
get() = field
|
||||||
|
|
||||||
fun foo() {
|
|
||||||
<!INACCESSIBLE_BACKING_FIELD!>$y<!> = 34
|
|
||||||
}
|
|
||||||
@@ -1,9 +1,8 @@
|
|||||||
package
|
package
|
||||||
|
|
||||||
package kt782 {
|
package kt782 {
|
||||||
public val w: kotlin.Int
|
public val w: kotlin.Int = 56
|
||||||
public val x: kotlin.Int
|
public val x: kotlin.Int
|
||||||
public val y: kotlin.Int = 11
|
public val y: kotlin.Int = 11
|
||||||
public val z: kotlin.Int = 34
|
public val z: kotlin.Int = 34
|
||||||
public fun foo(): kotlin.Unit
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
abstract class Bar {
|
|
||||||
abstract var bar : String
|
|
||||||
fun foo() = "foo" + this.<!NO_BACKING_FIELD_ABSTRACT_PROPERTY!>$bar<!>
|
|
||||||
}
|
|
||||||
@@ -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
|
|
||||||
}
|
|
||||||
Vendored
+1
-3
@@ -135,7 +135,6 @@ class AnonymousInitializers(var a: String, val b: String) {
|
|||||||
|
|
||||||
init {
|
init {
|
||||||
<!VAL_REASSIGNMENT!>i<!> = 13
|
<!VAL_REASSIGNMENT!>i<!> = 13
|
||||||
<!NO_BACKING_FIELD_CUSTOM_ACCESSORS!>$j<!> = 30
|
|
||||||
<!VAL_REASSIGNMENT!>j<!> = 34
|
<!VAL_REASSIGNMENT!>j<!> = 34
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -241,7 +240,7 @@ class Outer() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class ForwardAccessToBackingField() { //kt-147
|
class ForwardAccessToBackingField() { //kt-147
|
||||||
val a = <!TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM, UNINITIALIZED_VARIABLE!>$a<!> // error
|
val a = <!TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM, UNINITIALIZED_VARIABLE!>a<!> // error
|
||||||
val b = <!UNINITIALIZED_VARIABLE!>c<!> // error
|
val b = <!UNINITIALIZED_VARIABLE!>c<!> // error
|
||||||
val c = 1
|
val c = 1
|
||||||
}
|
}
|
||||||
@@ -327,7 +326,6 @@ fun func() {
|
|||||||
val x = b
|
val x = b
|
||||||
init {
|
init {
|
||||||
<!VAL_REASSIGNMENT!>b<!> = 4
|
<!VAL_REASSIGNMENT!>b<!> = 4
|
||||||
<!UNRESOLVED_REFERENCE!>$b<!> = 3
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+1
-1
@@ -61,7 +61,7 @@ package uninitialized_reassigned_variables {
|
|||||||
|
|
||||||
public final class ForwardAccessToBackingField {
|
public final class ForwardAccessToBackingField {
|
||||||
public constructor 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 b: kotlin.Int = 1
|
||||||
public final val c: kotlin.Int = 1
|
public final val c: kotlin.Int = 1
|
||||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import kotlin.reflect.KProperty
|
|||||||
class B {
|
class B {
|
||||||
val a: Int by Delegate()
|
val a: Int by Delegate()
|
||||||
|
|
||||||
fun foo() = <!NO_BACKING_FIELD_CUSTOM_ACCESSORS!>$a<!>
|
fun foo() =<!SYNTAX!><!> <!SYNTAX!>$a<!>
|
||||||
}
|
}
|
||||||
|
|
||||||
class Delegate {
|
class Delegate {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ public final class B {
|
|||||||
public constructor B()
|
public constructor B()
|
||||||
public final val a: kotlin.Int
|
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 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 hashCode(): kotlin.Int
|
||||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -3,7 +3,7 @@ package h
|
|||||||
class Square() {
|
class Square() {
|
||||||
var size : Double =
|
var size : Double =
|
||||||
<!UNRESOLVED_REFERENCE!>set<!>(<!UNRESOLVED_REFERENCE!>value<!>) {
|
<!UNRESOLVED_REFERENCE!>set<!>(<!UNRESOLVED_REFERENCE!>value<!>) {
|
||||||
<!BACKING_FIELD_USAGE_FORBIDDEN!>$area<!> = size * size
|
<!SYNTAX!>$area<!> <!SYNTAX!>= size * size<!>
|
||||||
}
|
}
|
||||||
|
|
||||||
<!MUST_BE_INITIALIZED_OR_BE_ABSTRACT!>var area : Double<!>
|
<!MUST_BE_INITIALIZED_OR_BE_ABSTRACT!>var area : Double<!>
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ class B(<!UNUSED_PARAMETER!>y<!>: Int) : A(<!UNRESOLVED_REFERENCE!>x<!>) //x is
|
|||||||
|
|
||||||
//KT-617 Prohibit dollars in call to superclass constructors
|
//KT-617 Prohibit dollars in call to superclass constructors
|
||||||
open class M(<!UNUSED_PARAMETER!>p<!>: Int)
|
open class M(<!UNUSED_PARAMETER!>p<!>: Int)
|
||||||
class N(val p: Int) : A(<!UNRESOLVED_REFERENCE!>$p<!>)
|
class N(val p: Int) : A(<!SYNTAX!><!SYNTAX!><!>$p<!><!SYNTAX!>)<!>
|
||||||
|
|
||||||
//KT-10 Don't allow to use properties in supertype initializers
|
//KT-10 Don't allow to use properties in supertype initializers
|
||||||
open class Element()
|
open class Element()
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ class BinaryHeap<T> : IPriorityQueue<T> {
|
|||||||
val Int.value : T = foo.bar()
|
val Int.value : T = foo.bar()
|
||||||
get() = data[this]
|
get() = data[this]
|
||||||
set(it) {
|
set(it) {
|
||||||
$value = it
|
field = it
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -837,7 +837,7 @@ JetFile: BinaryHeap.kt
|
|||||||
PsiWhiteSpace('\n ')
|
PsiWhiteSpace('\n ')
|
||||||
BINARY_EXPRESSION
|
BINARY_EXPRESSION
|
||||||
REFERENCE_EXPRESSION
|
REFERENCE_EXPRESSION
|
||||||
PsiElement(FIELD_IDENTIFIER)('$value')
|
PsiElement(IDENTIFIER)('field')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
OPERATION_REFERENCE
|
OPERATION_REFERENCE
|
||||||
PsiElement(EQ)('=')
|
PsiElement(EQ)('=')
|
||||||
|
|||||||
@@ -4,12 +4,12 @@ interface Base {
|
|||||||
|
|
||||||
var ~setter1~Int.setter1: Int = 2
|
var ~setter1~Int.setter1: Int = 2
|
||||||
set(i: Int) {
|
set(i: Int) {
|
||||||
$setter1 = `setter1`this@setter1
|
field = `setter1`this@setter1
|
||||||
}
|
}
|
||||||
|
|
||||||
var ~setter2~Int.setter2: Base? = null
|
var ~setter2~Int.setter2: Base? = null
|
||||||
set(i: Base?) {
|
set(i: Base?) {
|
||||||
$setter2 = object: Base {
|
field = object: Base {
|
||||||
override fun foo() {
|
override fun foo() {
|
||||||
`setter2`this@setter2
|
`setter2`this@setter2
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -480,18 +480,6 @@ public class ControlFlowTestGenerated extends AbstractControlFlowTest {
|
|||||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/cfg/declarations/properties"), Pattern.compile("^(.+)\\.kt$"), true);
|
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")
|
@TestMetadata("DelegatedProperty.kt")
|
||||||
public void testDelegatedProperty() throws Exception {
|
public void testDelegatedProperty() throws Exception {
|
||||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/cfg/declarations/properties/DelegatedProperty.kt");
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/cfg/declarations/properties/DelegatedProperty.kt");
|
||||||
|
|||||||
@@ -482,18 +482,6 @@ public class PseudoValueTestGenerated extends AbstractPseudoValueTest {
|
|||||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/cfg/declarations/properties"), Pattern.compile("^(.+)\\.kt$"), true);
|
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")
|
@TestMetadata("DelegatedProperty.kt")
|
||||||
public void testDelegatedProperty() throws Exception {
|
public void testDelegatedProperty() throws Exception {
|
||||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/cfg/declarations/properties/DelegatedProperty.kt");
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/cfg/declarations/properties/DelegatedProperty.kt");
|
||||||
|
|||||||
@@ -1476,12 +1476,6 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
|
|||||||
doTest(fileName);
|
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")
|
@TestMetadata("ExtensionProperty.kt")
|
||||||
public void testExtensionProperty() throws Exception {
|
public void testExtensionProperty() throws Exception {
|
||||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/backingField/ExtensionProperty.kt");
|
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");
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/backingField/kt782packageLevel.kt");
|
||||||
doTest(fileName);
|
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")
|
@TestMetadata("compiler/testData/diagnostics/tests/callableReference")
|
||||||
|
|||||||
-3
@@ -52,9 +52,6 @@ class PropertiesHighlightingVisitor extends AfterAnalysisHighlightingVisitor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
highlightProperty(expression, (PropertyDescriptor) target, false);
|
highlightProperty(expression, (PropertyDescriptor) target, false);
|
||||||
if (expression.getReferencedNameElementType() == KtTokens.FIELD_IDENTIFIER) {
|
|
||||||
NameHighlighter.highlightName(holder, expression, JetHighlightingColors.BACKING_FIELD_ACCESS);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+1
-7
@@ -84,16 +84,10 @@ class KtSimpleNameReference(expression: KtSimpleNameExpression) : KtSimpleRefere
|
|||||||
}
|
}
|
||||||
|
|
||||||
val psiFactory = KtPsiFactory(expression)
|
val psiFactory = KtPsiFactory(expression)
|
||||||
val element = when (expression.getReferencedNameElementType()) {
|
val element = Extensions.getArea(expression.getProject()).getExtensionPoint(SimpleNameReferenceExtension.EP_NAME).extensions
|
||||||
KtTokens.FIELD_IDENTIFIER -> psiFactory.createFieldIdentifier(newElementName)
|
|
||||||
|
|
||||||
else -> {
|
|
||||||
Extensions.getArea(expression.getProject()).getExtensionPoint(SimpleNameReferenceExtension.EP_NAME).getExtensions()
|
|
||||||
.asSequence()
|
.asSequence()
|
||||||
.map { it.handleElementRename(this, psiFactory, newElementName) }
|
.map { it.handleElementRename(this, psiFactory, newElementName) }
|
||||||
.firstOrNull { it != null } ?: psiFactory.createNameIdentifier(newElementName)
|
.firstOrNull { it != null } ?: psiFactory.createNameIdentifier(newElementName)
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
val nameElement = expression.getReferencedNameElement()
|
val nameElement = expression.getReferencedNameElement()
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ val KOTLIN_NAMED_ARGUMENT_SEARCH_CONTEXT: Short = 0x20
|
|||||||
class KotlinFilterLexer(private val occurrenceConsumer: OccurrenceConsumer): BaseFilterLexer(KotlinLexer(), occurrenceConsumer) {
|
class KotlinFilterLexer(private val occurrenceConsumer: OccurrenceConsumer): BaseFilterLexer(KotlinLexer(), occurrenceConsumer) {
|
||||||
private val codeTokens = TokenSet.orSet(
|
private val codeTokens = TokenSet.orSet(
|
||||||
TokenSet.create(*ALL_SEARCHABLE_OPERATIONS.toTypedArray()),
|
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))
|
private val commentTokens = TokenSet.orSet(KtTokens.COMMENTS, TokenSet.create(KDocTokens.KDOC))
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
val a: Int = 1
|
val a: Int = 1
|
||||||
get() {
|
get() {
|
||||||
return $a
|
return field
|
||||||
}
|
}
|
||||||
set(v) {
|
set(v) {
|
||||||
$a = <caret>
|
field = <caret>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -90,7 +90,6 @@ public class KotlinCleanupInspection(): LocalInspectionTool(), CleanupLocalInspe
|
|||||||
ErrorsJvm.POSITIONED_VALUE_ARGUMENT_FOR_JAVA_ANNOTATION,
|
ErrorsJvm.POSITIONED_VALUE_ARGUMENT_FOR_JAVA_ANNOTATION,
|
||||||
Errors.DEPRECATION,
|
Errors.DEPRECATION,
|
||||||
Errors.NON_CONST_VAL_USED_IN_CONSTANT_EXPRESSION,
|
Errors.NON_CONST_VAL_USED_IN_CONSTANT_EXPRESSION,
|
||||||
Errors.BACKING_FIELD_OLD_SYNTAX,
|
|
||||||
Errors.OPERATOR_MODIFIER_REQUIRED,
|
Errors.OPERATOR_MODIFIER_REQUIRED,
|
||||||
Errors.DEPRECATED_UNARY_PLUS_MINUS,
|
Errors.DEPRECATED_UNARY_PLUS_MINUS,
|
||||||
Errors.DELEGATE_RESOLVED_TO_DEPRECATED_CONVENTION,
|
Errors.DELEGATE_RESOLVED_TO_DEPRECATED_CONVENTION,
|
||||||
|
|||||||
@@ -82,8 +82,6 @@ class IntroduceBackingPropertyIntention(): JetSelfTargetingIntention<KtProperty>
|
|||||||
}
|
}
|
||||||
|
|
||||||
property.setInitializer(null)
|
property.setInitializer(null)
|
||||||
|
|
||||||
replaceBackingFieldReferences(property)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun createGetter(element: KtProperty) {
|
private fun createGetter(element: KtProperty) {
|
||||||
@@ -136,17 +134,6 @@ class IntroduceBackingPropertyIntention(): JetSelfTargetingIntention<KtProperty>
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: drop this when we get rid of backing field syntax
|
|
||||||
private fun replaceBackingFieldReferences(prop: KtProperty) {
|
|
||||||
val containingClass = prop.getStrictParentOfType<KtClassOrObject>()!!
|
|
||||||
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}"))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -331,10 +331,6 @@ public class QuickFixRegistrar : QuickFixContributor {
|
|||||||
|
|
||||||
NON_CONST_VAL_USED_IN_CONSTANT_EXPRESSION.registerFactory(ConstFixFactory)
|
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))
|
OPERATOR_MODIFIER_REQUIRED.registerFactory(AddModifierFixFactory(KtTokens.OPERATOR_KEYWORD))
|
||||||
INFIX_MODIFIER_REQUIRED.registerFactory(AddModifierFixFactory(KtTokens.INFIX_KEYWORD))
|
INFIX_MODIFIER_REQUIRED.registerFactory(AddModifierFixFactory(KtTokens.INFIX_KEYWORD))
|
||||||
|
|
||||||
|
|||||||
+1
-4
@@ -11,10 +11,8 @@ interface NoC {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class WithC() {
|
class WithC() {
|
||||||
val x : Int
|
val x : Int = 42
|
||||||
init {
|
init {
|
||||||
<error>$x</error> = 1
|
|
||||||
<error>$y</error> = 2
|
|
||||||
val <warning>b</warning> = x
|
val <warning>b</warning> = x
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -24,7 +22,6 @@ class WithC() {
|
|||||||
init {
|
init {
|
||||||
val <warning>z</warning> = <error>b</error>
|
val <warning>z</warning> = <error>b</error>
|
||||||
val <warning>zz</warning> = x
|
val <warning>zz</warning> = x
|
||||||
val <warning>zzz</warning> = <error>$a</error>
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
-1
@@ -28,7 +28,6 @@ class WithCPI_Dup(<warning>x</warning> : Int) {
|
|||||||
|
|
||||||
class WithCPI(x : Int) {
|
class WithCPI(x : Int) {
|
||||||
val a = 1
|
val a = 1
|
||||||
val b : Int = <error>$a</error>
|
|
||||||
val xy : Int = x
|
val xy : Int = x
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
-6
@@ -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 = <error>$a</error> // error here, but must not be
|
|
||||||
}
|
|
||||||
@@ -39,12 +39,6 @@ annotation class Fancy(val param: Int)
|
|||||||
|
|
||||||
@Fancy(<caret>i) class D
|
@Fancy(<caret>i) class D
|
||||||
|
|
||||||
class Foo {
|
|
||||||
var x: Int = 0
|
|
||||||
get = $x
|
|
||||||
set(value) { $x = value }
|
|
||||||
}
|
|
||||||
|
|
||||||
class CustomDelegate {
|
class CustomDelegate {
|
||||||
operator fun get(thisRef: Any?, prop: PropertyMetadata): String = ""
|
operator fun get(thisRef: Any?, prop: PropertyMetadata): String = ""
|
||||||
operator fun set(thisRef: Any?, prop: PropertyMetadata, value: String) {}
|
operator fun set(thisRef: Any?, prop: PropertyMetadata, value: String) {}
|
||||||
|
|||||||
@@ -39,12 +39,6 @@ annotation class Fancy(val param: Int)
|
|||||||
|
|
||||||
@Fancy(i) class D
|
@Fancy(i) class D
|
||||||
|
|
||||||
class Foo {
|
|
||||||
var x: Int = 0
|
|
||||||
get = field
|
|
||||||
set(value) { field = value }
|
|
||||||
}
|
|
||||||
|
|
||||||
class CustomDelegate {
|
class CustomDelegate {
|
||||||
operator fun getValue(thisRef: Any?, prop: KProperty<*>): String = ""
|
operator fun getValue(thisRef: Any?, prop: KProperty<*>): String = ""
|
||||||
operator fun setValue(thisRef: Any?, prop: KProperty<*>, value: String) {}
|
operator fun setValue(thisRef: Any?, prop: KProperty<*>, value: String) {}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
// "Remove getter and initializer from property" "true"
|
// "Remove getter and initializer from property" "true"
|
||||||
abstract class B {
|
abstract class B {
|
||||||
abstract val i = <caret>0
|
abstract val i = <caret>0
|
||||||
get() = $i
|
get() = field
|
||||||
}
|
}
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
// "Migrate backing field syntax" "true"
|
|
||||||
|
|
||||||
class Foo {
|
|
||||||
var a: Int = 0
|
|
||||||
get() = 0
|
|
||||||
set(v) { $<caret>a = v }
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
// "Migrate backing field syntax" "true"
|
|
||||||
|
|
||||||
class Foo {
|
|
||||||
var a: Int = 0
|
|
||||||
get() = 0
|
|
||||||
set(v) { field = v }
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
// "Introduce backing property" "true"
|
|
||||||
|
|
||||||
class Foo {
|
|
||||||
var x = ""
|
|
||||||
get() = $x + "!"
|
|
||||||
set(value) { $x = value + "!" }
|
|
||||||
|
|
||||||
fun foo(): String {
|
|
||||||
return $<caret>x
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-12
@@ -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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
// "Replace with property access" "true"
|
|
||||||
|
|
||||||
class A {
|
|
||||||
var foo: Int = 0
|
|
||||||
|
|
||||||
fun bar() = $f<caret>oo
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
// "Replace with property access" "true"
|
|
||||||
|
|
||||||
class A {
|
|
||||||
var foo: Int = 0
|
|
||||||
|
|
||||||
fun bar() = foo
|
|
||||||
}
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
// "Change '$foo' to 'foo'" "true"
|
|
||||||
abstract class Foo {
|
|
||||||
abstract var foo : String
|
|
||||||
fun bar() = <caret>$foo + "bar"
|
|
||||||
}
|
|
||||||
-5
@@ -1,5 +0,0 @@
|
|||||||
// "Change '$foo' to 'foo'" "true"
|
|
||||||
abstract class Foo {
|
|
||||||
abstract var foo : String
|
|
||||||
fun bar() = <caret>foo + "bar"
|
|
||||||
}
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
// "Change '$bar' to 'bar'" "true"
|
|
||||||
abstract class Bar {
|
|
||||||
abstract var bar : String
|
|
||||||
fun foo() = "foo" + this.<caret>$bar
|
|
||||||
}
|
|
||||||
-5
@@ -1,5 +0,0 @@
|
|||||||
// "Change '$bar' to 'bar'" "true"
|
|
||||||
abstract class Bar {
|
|
||||||
abstract var bar : String
|
|
||||||
fun foo() = "foo" + this.<caret>bar
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
// "Change '$foo' to 'foo'" "true"
|
|
||||||
class A {
|
|
||||||
val foo : Int
|
|
||||||
get() = 5
|
|
||||||
val bar : Int
|
|
||||||
get() = $<caret>foo
|
|
||||||
}
|
|
||||||
-7
@@ -1,7 +0,0 @@
|
|||||||
// "Change '$foo' to 'foo'" "true"
|
|
||||||
class A {
|
|
||||||
val foo : Int
|
|
||||||
get() = 5
|
|
||||||
val bar : Int
|
|
||||||
get() = <caret>foo
|
|
||||||
}
|
|
||||||
-5
@@ -1,5 +0,0 @@
|
|||||||
// "Change '$a' to 'a'" "true"
|
|
||||||
val a = 5
|
|
||||||
class A {
|
|
||||||
val b = <caret>$a
|
|
||||||
}
|
|
||||||
-5
@@ -1,5 +0,0 @@
|
|||||||
// "Change '$a' to 'a'" "true"
|
|
||||||
val a = 5
|
|
||||||
class A {
|
|
||||||
val b = <caret>a
|
|
||||||
}
|
|
||||||
-6
@@ -1,6 +0,0 @@
|
|||||||
// "Change '$a' to 'a'" "true"
|
|
||||||
package foo
|
|
||||||
val a = 5
|
|
||||||
class A {
|
|
||||||
val b = foo.<caret>$a
|
|
||||||
}
|
|
||||||
Vendored
-6
@@ -1,6 +0,0 @@
|
|||||||
// "Change '$a' to 'a'" "true"
|
|
||||||
package foo
|
|
||||||
val a = 5
|
|
||||||
class A {
|
|
||||||
val b = foo.<caret>a
|
|
||||||
}
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
class aClass(){
|
class aClass(){
|
||||||
var myF<caret>ield: Int = 0;
|
var myF<caret>ield: Int = 0;
|
||||||
set(value){
|
set(value){
|
||||||
$myField=value
|
field=value
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
class aClass(){
|
class aClass(){
|
||||||
var renamed: Int = 0;
|
var renamed: Int = 0;
|
||||||
set(value){
|
set(value){
|
||||||
$renamed =value
|
field=value
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
class aClass(){
|
class aClass(){
|
||||||
var myField: Int = 0;
|
var myField: Int = 0;
|
||||||
set(value){
|
set(value){
|
||||||
$myFi<caret>eld=value
|
fi<caret>eld=value
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
class aClass(){
|
class aClass(){
|
||||||
var anotherRenamed: Int = 0;
|
var anotherRenamed: Int = 0;
|
||||||
set(value){
|
set(value){
|
||||||
$anotherRenamed =value
|
field=value
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -442,12 +442,6 @@ public class JetPsiCheckerTestGenerated extends AbstractJetPsiCheckerTest {
|
|||||||
doTest(fileName);
|
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")
|
@TestMetadata("Jet183.kt")
|
||||||
public void testJet183() throws Exception {
|
public void testJet183() throws Exception {
|
||||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/checker/regression/Jet183.kt");
|
String fileName = JetTestUtils.navigationMetadata("idea/testData/checker/regression/Jet183.kt");
|
||||||
|
|||||||
@@ -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")
|
@TestMetadata("idea/testData/quickfix/migration/conflictingExtension")
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
@RunWith(JUnit3RunnerWithInners.class)
|
@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")
|
@TestMetadata("idea/testData/quickfix/variables/removeValVarFromParameter")
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
@RunWith(JUnit3RunnerWithInners.class)
|
@RunWith(JUnit3RunnerWithInners.class)
|
||||||
|
|||||||
+1
-1
@@ -103,7 +103,7 @@ public final class ReferenceTranslator {
|
|||||||
public static AccessTranslator getAccessTranslator(@NotNull KtSimpleNameExpression referenceExpression,
|
public static AccessTranslator getAccessTranslator(@NotNull KtSimpleNameExpression referenceExpression,
|
||||||
@Nullable JsExpression receiver,
|
@Nullable JsExpression receiver,
|
||||||
@NotNull TranslationContext context) {
|
@NotNull TranslationContext context) {
|
||||||
if (isBackingFieldReference(referenceExpression, getDescriptorForReferenceExpression(context.bindingContext(), referenceExpression))) {
|
if (isBackingFieldReference(getDescriptorForReferenceExpression(context.bindingContext(), referenceExpression))) {
|
||||||
return BackingFieldAccessTranslator.newInstance(referenceExpression, context);
|
return BackingFieldAccessTranslator.newInstance(referenceExpression, context);
|
||||||
}
|
}
|
||||||
if (canBePropertyAccess(referenceExpression, context)) {
|
if (canBePropertyAccess(referenceExpression, context)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user