From e2b6d2d849e0f9daa438a1ff1061a6bdb4f2d849 Mon Sep 17 00:00:00 2001 From: Dmitry Petrov Date: Tue, 6 Dec 2016 15:35:23 +0300 Subject: [PATCH] Drop 'propertyDelegated' convention (without additional deprecation ceremony). --- .../kotlin/codegen/ExpressionCodegen.java | 14 ----- .../kotlin/checkers/DebugInfoUtil.java | 2 +- .../kotlin/resolve/BindingContext.java | 2 - .../resolve/DelegatedPropertyResolver.kt | 53 ++----------------- .../propertyDelegatedAmbiguity.kt | 15 ------ .../propertyDelegatedAmbiguity.txt | 13 ----- .../propertyDelegatedIncomplete.kt | 13 ----- .../propertyDelegatedIncomplete.txt | 12 ----- .../propertyDelegatedMissing.kt | 11 ---- .../propertyDelegatedMissing.txt | 11 ---- .../propertyDelegatedPrivate.kt | 13 ----- .../propertyDelegatedPrivate.txt | 12 ----- .../propertyDelegatedWrongArguments.kt | 19 ------- .../propertyDelegatedWrongArguments.txt | 15 ------ .../dynamicTypes/conventions.dynamic.txt | 2 - .../dynamicTypes/conventions.kt | 4 +- .../checkers/DiagnosticsTestGenerated.java | 30 ----------- .../KtPropertyDelegationMethodsReference.kt | 2 +- .../propertyDelegatedFunction.0.kt | 16 ------ .../conventions/propertyDelegatedFunction.log | 4 -- .../propertyDelegatedFunction.results.txt | 1 - .../getSetPropertyDelegatedExtension.kt | 13 ----- .../inSource/getSetPropertyDelegatedMember.kt | 13 ----- .../findUsages/FindUsagesTestGenerated.java | 6 --- .../ReferenceResolveTestGenerated.java | 12 ----- 25 files changed, 8 insertions(+), 300 deletions(-) delete mode 100644 compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedAmbiguity.kt delete mode 100644 compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedAmbiguity.txt delete mode 100644 compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedIncomplete.kt delete mode 100644 compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedIncomplete.txt delete mode 100644 compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedMissing.kt delete mode 100644 compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedMissing.txt delete mode 100644 compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedPrivate.kt delete mode 100644 compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedPrivate.txt delete mode 100644 compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedWrongArguments.kt delete mode 100644 compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedWrongArguments.txt delete mode 100644 idea/testData/findUsages/kotlin/conventions/propertyDelegatedFunction.0.kt delete mode 100644 idea/testData/findUsages/kotlin/conventions/propertyDelegatedFunction.log delete mode 100644 idea/testData/findUsages/kotlin/conventions/propertyDelegatedFunction.results.txt delete mode 100644 idea/testData/resolve/references/delegatedPropertyAccessors/inSource/getSetPropertyDelegatedExtension.kt delete mode 100644 idea/testData/resolve/references/delegatedPropertyAccessors/inSource/getSetPropertyDelegatedMember.kt diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java index 9309ea57022..58e3e82c892 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java @@ -4086,7 +4086,6 @@ public class ExpressionCodegen extends KtVisitor impleme if (isDelegatedLocalVariable(variableDescriptor)) { StackValue metadataValue = getVariableMetadataValue(variableDescriptor); initializePropertyMetadata((KtProperty) variableDeclaration, variableDescriptor, metadataValue); - invokePropertyDelegatedOnLocalVar(variableDescriptor, storeTo, metadataValue); } } @@ -4097,19 +4096,6 @@ public class ExpressionCodegen extends KtVisitor impleme return descriptor; } - private void invokePropertyDelegatedOnLocalVar( - @NotNull LocalVariableDescriptor variableDescriptor, - @NotNull StackValue delegateValue, - @NotNull StackValue metadataValue - ) { - ResolvedCall pdResolvedCall = - bindingContext.get(BindingContext.DELEGATED_PROPERTY_PD_RESOLVED_CALL, variableDescriptor); - if (pdResolvedCall == null) return; - - tempVariables.put(pdResolvedCall.getCall().getValueArguments().get(0).asElement(), metadataValue); - invokeFunction(pdResolvedCall, delegateValue).put(Type.VOID_TYPE, v); - } - private void initializePropertyMetadata( @NotNull KtProperty variable, @NotNull LocalVariableDescriptor variableDescriptor, diff --git a/compiler/frontend/src/org/jetbrains/kotlin/checkers/DebugInfoUtil.java b/compiler/frontend/src/org/jetbrains/kotlin/checkers/DebugInfoUtil.java index b63a3afeb99..33b40720fed 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/checkers/DebugInfoUtil.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/checkers/DebugInfoUtil.java @@ -118,9 +118,9 @@ public class DebugInfoUtil { VariableDescriptor descriptor = bindingContext.get(VARIABLE, property); if (descriptor instanceof PropertyDescriptor && property.getDelegate() != null) { PropertyDescriptor propertyDescriptor = (PropertyDescriptor) descriptor; + reportIfDynamicCall(property.getDelegate(), propertyDescriptor, TO_DELEGATE_FOR_RESOLVED_CALL); reportIfDynamicCall(property.getDelegate(), propertyDescriptor.getGetter(), DELEGATED_PROPERTY_RESOLVED_CALL); reportIfDynamicCall(property.getDelegate(), propertyDescriptor.getSetter(), DELEGATED_PROPERTY_RESOLVED_CALL); - reportIfDynamicCall(property.getDelegate(), propertyDescriptor, DELEGATED_PROPERTY_PD_RESOLVED_CALL); } super.visitProperty(property); } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/BindingContext.java b/compiler/frontend/src/org/jetbrains/kotlin/resolve/BindingContext.java index 535782e41f6..5d186cc9cda 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/BindingContext.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/BindingContext.java @@ -144,8 +144,6 @@ public interface BindingContext { WritableSlice> TO_DELEGATE_FOR_RESOLVED_CALL = Slices.createSimpleSlice(); WritableSlice TO_DELEGATE_FOR_CALL = Slices.createSimpleSlice(); - WritableSlice> DELEGATED_PROPERTY_PD_RESOLVED_CALL = Slices.createSimpleSlice(); - WritableSlice> COMPONENT_RESOLVED_CALL = Slices.createSimpleSlice(); WritableSlice> INDEXED_LVALUE_GET = Slices.createSimpleSlice(); diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/DelegatedPropertyResolver.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/DelegatedPropertyResolver.kt index 0649a55b0ba..5cd2167a9b3 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/DelegatedPropertyResolver.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/DelegatedPropertyResolver.kt @@ -72,17 +72,10 @@ class DelegatedPropertyResolver( if (setter.hasBody()) trace.report(ACCESSOR_FOR_DELEGATED_PROPERTY.on(setter)) } - val delegateFunctionsScope: LexicalScope - val initializerScope: LexicalScope - - if (variableDescriptor is PropertyDescriptor) { - delegateFunctionsScope = ScopeUtils.makeScopeForDelegateConventionFunctions(propertyHeaderScope, variableDescriptor) - initializerScope = ScopeUtils.makeScopeForPropertyInitializer(propertyHeaderScope, variableDescriptor) - } - else { - initializerScope = propertyHeaderScope - delegateFunctionsScope = initializerScope - } + val initializerScope: LexicalScope = + if (variableDescriptor is PropertyDescriptor) + ScopeUtils.makeScopeForPropertyInitializer(propertyHeaderScope, variableDescriptor) + else propertyHeaderScope val byExpressionType = resolveDelegateExpression(delegateExpression, property, variableDescriptor, initializerScope, trace, outerDataFlowInfo) @@ -93,8 +86,6 @@ class DelegatedPropertyResolver( if (property.isVar) { resolveSetValueMethod(variableDescriptor, delegateExpression, delegateType, trace, initializerScope, outerDataFlowInfo) } - - resolvePropertyDelegatedMethod(variableDescriptor, delegateExpression, delegateType, trace, delegateFunctionsScope, outerDataFlowInfo) } private fun getResolvedDelegateType( @@ -166,42 +157,6 @@ class DelegatedPropertyResolver( return createExpression("null as ${KotlinBuiltIns.FQ_NAMES.kProperty.asSingleFqName().asString()}<*>") } - private fun resolvePropertyDelegatedMethod( - variableDescriptor: VariableDescriptorWithAccessors, - delegateExpression: KtExpression, - delegateType: KotlinType, - trace: BindingTrace, - delegateFunctionsScope: LexicalScope, - dataFlowInfo: DataFlowInfo - ) { - val traceToResolvePDMethod = TemporaryBindingTrace.create(trace, "Trace to resolve propertyDelegated method in delegated property") - val context = ExpressionTypingContext.newContext(traceToResolvePDMethod, delegateFunctionsScope, dataFlowInfo, TypeUtils.NO_EXPECTED_TYPE) - - val psiFactory = KtPsiFactory(delegateExpression) - val arguments = listOf(psiFactory.createExpressionForProperty()) - val receiver = ExpressionReceiver.create(delegateExpression, delegateType, trace.bindingContext) - - val resolutionResult = fakeCallResolver.makeAndResolveFakeCallInContext(receiver, context, arguments, - OperatorNameConventions.PROPERTY_DELEGATED, delegateExpression) - - val call = resolutionResult.first - val functionResults = resolutionResult.second - - if (!functionResults.isSuccess) { - val expectedFunction = renderCall(call, traceToResolvePDMethod.bindingContext) - if (functionResults.isIncomplete || functionResults.isSingleResult || - functionResults.resultCode == OverloadResolutionResults.Code.MANY_FAILED_CANDIDATES) { - trace.report(DELEGATE_PD_METHOD_NONE_APPLICABLE.on(delegateExpression, expectedFunction, functionResults.resultingCalls)) - } - else if (functionResults.isAmbiguity) { - trace.report(DELEGATE_SPECIAL_FUNCTION_AMBIGUITY.on(delegateExpression, expectedFunction, functionResults.resultingCalls)) - } - return - } - - trace.record(DELEGATED_PROPERTY_PD_RESOLVED_CALL, variableDescriptor, functionResults.resultingCall) - } - /* Resolve getValue() or setValue() methods from delegate */ private fun resolveGetSetValueMethod( propertyDescriptor: VariableDescriptorWithAccessors, diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedAmbiguity.kt b/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedAmbiguity.kt deleted file mode 100644 index 0cb21f987a4..00000000000 --- a/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedAmbiguity.kt +++ /dev/null @@ -1,15 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_PARAMETER - -import kotlin.reflect.KProperty - -val a: Int by Delegate() - -class Delegate { - operator fun getValue(t: Any?, p: KProperty<*>): Int { - return 1 - } - - fun propertyDelegated(p: KProperty<*>, i: Int = 1) {} - - fun propertyDelegated(p: KProperty<*>, s: String = "") {} -} diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedAmbiguity.txt b/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedAmbiguity.txt deleted file mode 100644 index e4d8ebe8173..00000000000 --- a/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedAmbiguity.txt +++ /dev/null @@ -1,13 +0,0 @@ -package - -public val a: kotlin.Int - -public final class Delegate { - public constructor Delegate() - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.reflect.KProperty<*>): kotlin.Int - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public final fun propertyDelegated(/*0*/ p: kotlin.reflect.KProperty<*>, /*1*/ i: kotlin.Int = ...): kotlin.Unit - public final fun propertyDelegated(/*0*/ p: kotlin.reflect.KProperty<*>, /*1*/ s: kotlin.String = ...): kotlin.Unit - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String -} diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedIncomplete.kt b/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedIncomplete.kt deleted file mode 100644 index 9d20e8dcfaa..00000000000 --- a/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedIncomplete.kt +++ /dev/null @@ -1,13 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_PARAMETER - -import kotlin.reflect.KProperty - -val a: Int by Delegate() - -class Delegate { - operator fun getValue(t: Any?, p: KProperty<*>): Int { - return 1 - } - - fun propertyDelegated(p: KProperty<*>) {} -} diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedIncomplete.txt b/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedIncomplete.txt deleted file mode 100644 index 2014416a750..00000000000 --- a/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedIncomplete.txt +++ /dev/null @@ -1,12 +0,0 @@ -package - -public val a: kotlin.Int - -public final class Delegate { - public constructor Delegate() - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.reflect.KProperty<*>): kotlin.Int - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public final fun propertyDelegated(/*0*/ p: kotlin.reflect.KProperty<*>): kotlin.Unit - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String -} diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedMissing.kt b/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedMissing.kt deleted file mode 100644 index 5824720b6aa..00000000000 --- a/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedMissing.kt +++ /dev/null @@ -1,11 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_PARAMETER - -import kotlin.reflect.KProperty - -val a: Int by Delegate() - -class Delegate { - operator fun getValue(t: Any?, p: KProperty<*>): Int { - return 1 - } -} diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedMissing.txt b/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedMissing.txt deleted file mode 100644 index f1ca1ccc34c..00000000000 --- a/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedMissing.txt +++ /dev/null @@ -1,11 +0,0 @@ -package - -public val a: kotlin.Int - -public final class Delegate { - public constructor Delegate() - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.reflect.KProperty<*>): 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/delegatedProperty/propertyDelegatedPrivate.kt b/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedPrivate.kt deleted file mode 100644 index e8da0e289c2..00000000000 --- a/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedPrivate.kt +++ /dev/null @@ -1,13 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_PARAMETER - -import kotlin.reflect.KProperty - -val a: Int by Delegate() - -class Delegate { - operator fun getValue(t: Any?, p: KProperty<*>): Int { - return 1 - } - - private fun propertyDelegated(p: KProperty<*>) {} -} diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedPrivate.txt b/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedPrivate.txt deleted file mode 100644 index e701fb1559f..00000000000 --- a/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedPrivate.txt +++ /dev/null @@ -1,12 +0,0 @@ -package - -public val a: kotlin.Int - -public final class Delegate { - public constructor Delegate() - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.reflect.KProperty<*>): kotlin.Int - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - private final fun propertyDelegated(/*0*/ p: kotlin.reflect.KProperty<*>): kotlin.Unit - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String -} diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedWrongArguments.kt b/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedWrongArguments.kt deleted file mode 100644 index 13e57affeac..00000000000 --- a/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedWrongArguments.kt +++ /dev/null @@ -1,19 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_PARAMETER - -import kotlin.reflect.KProperty - -val a: Int by Delegate() - -class Delegate { - operator fun getValue(t: Any?, p: KProperty<*>): Int { - return 1 - } - - fun propertyDelegated() {} - - fun propertyDelegated(a: Int) {} - - fun propertyDelegated(a: String) {} - - fun propertyDelegated(p: KProperty<*>, a: Int) {} -} diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedWrongArguments.txt b/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedWrongArguments.txt deleted file mode 100644 index c884349f2c0..00000000000 --- a/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedWrongArguments.txt +++ /dev/null @@ -1,15 +0,0 @@ -package - -public val a: kotlin.Int - -public final class Delegate { - public constructor Delegate() - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.reflect.KProperty<*>): kotlin.Int - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public final fun propertyDelegated(): kotlin.Unit - public final fun propertyDelegated(/*0*/ a: kotlin.Int): kotlin.Unit - public final fun propertyDelegated(/*0*/ a: kotlin.String): kotlin.Unit - public final fun propertyDelegated(/*0*/ p: kotlin.reflect.KProperty<*>, /*1*/ a: kotlin.Int): kotlin.Unit - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String -} diff --git a/compiler/testData/diagnostics/testsWithJsStdLib/dynamicTypes/conventions.dynamic.txt b/compiler/testData/diagnostics/testsWithJsStdLib/dynamicTypes/conventions.dynamic.txt index 775179792cc..17a25cee9ba 100644 --- a/compiler/testData/diagnostics/testsWithJsStdLib/dynamicTypes/conventions.dynamic.txt +++ b/compiler/testData/diagnostics/testsWithJsStdLib/dynamicTypes/conventions.dynamic.txt @@ -60,7 +60,5 @@ public final fun divAssign(/*0*/ p0: dynamic): dynamic public final fun get(/*0*/ p0: dynamic): dynamic public final fun remAssign(/*0*/ p0: dynamic): dynamic public final fun getValue(/*0*/ p0: dynamic, /*1*/ p1: dynamic): dynamic -public final fun propertyDelegated(/*0*/ p0: dynamic): dynamic public final fun getValue(/*0*/ p0: dynamic, /*1*/ p1: dynamic): dynamic public final fun setValue(/*0*/ p0: dynamic, /*1*/ p1: dynamic, /*2*/ p2: dynamic): dynamic -public final fun propertyDelegated(/*0*/ p0: dynamic): dynamic diff --git a/compiler/testData/diagnostics/testsWithJsStdLib/dynamicTypes/conventions.kt b/compiler/testData/diagnostics/testsWithJsStdLib/dynamicTypes/conventions.kt index 4196e5ab04d..45dffb2860e 100644 --- a/compiler/testData/diagnostics/testsWithJsStdLib/dynamicTypes/conventions.kt +++ b/compiler/testData/diagnostics/testsWithJsStdLib/dynamicTypes/conventions.kt @@ -89,5 +89,5 @@ fun test(d: dynamic) { } val dyn: dynamic = null -val foo : Int by dyn -var bar : Int by dyn +val foo : Int by dyn +var bar : Int by dyn diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java index f01916c473b..a5f8ca64adb 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java @@ -5620,36 +5620,6 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest { doTest(fileName); } - @TestMetadata("propertyDelegatedAmbiguity.kt") - public void testPropertyDelegatedAmbiguity() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedAmbiguity.kt"); - doTest(fileName); - } - - @TestMetadata("propertyDelegatedIncomplete.kt") - public void testPropertyDelegatedIncomplete() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedIncomplete.kt"); - doTest(fileName); - } - - @TestMetadata("propertyDelegatedMissing.kt") - public void testPropertyDelegatedMissing() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedMissing.kt"); - doTest(fileName); - } - - @TestMetadata("propertyDelegatedPrivate.kt") - public void testPropertyDelegatedPrivate() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedPrivate.kt"); - doTest(fileName); - } - - @TestMetadata("propertyDelegatedWrongArguments.kt") - public void testPropertyDelegatedWrongArguments() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedWrongArguments.kt"); - doTest(fileName); - } - @TestMetadata("recursiveType.kt") public void testRecursiveType() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/delegatedProperty/recursiveType.kt"); diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/references/KtPropertyDelegationMethodsReference.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/references/KtPropertyDelegationMethodsReference.kt index 65abe59dcda..a58a4874c03 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/references/KtPropertyDelegationMethodsReference.kt +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/references/KtPropertyDelegationMethodsReference.kt @@ -40,7 +40,7 @@ class KtPropertyDelegationMethodsReference(element: KtPropertyDelegate) : KtMult return (descriptor.accessors.mapNotNull { accessor -> context.get(BindingContext.DELEGATED_PROPERTY_RESOLVED_CALL, accessor)?.candidateDescriptor - } + listOfNotNull(context.get(BindingContext.DELEGATED_PROPERTY_PD_RESOLVED_CALL, descriptor)?.candidateDescriptor)) + } + listOfNotNull(context.get(BindingContext.TO_DELEGATE_FOR_RESOLVED_CALL, descriptor)?.candidateDescriptor)) } override val resolvesByNames: Collection get() = NAMES diff --git a/idea/testData/findUsages/kotlin/conventions/propertyDelegatedFunction.0.kt b/idea/testData/findUsages/kotlin/conventions/propertyDelegatedFunction.0.kt deleted file mode 100644 index ff92f3f1297..00000000000 --- a/idea/testData/findUsages/kotlin/conventions/propertyDelegatedFunction.0.kt +++ /dev/null @@ -1,16 +0,0 @@ -// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtNamedFunction -// OPTIONS: usages - -import kotlin.reflect.KProperty - -class Delegate() { - operator fun getValue(thisRef: Any?, property: KProperty<*>): String = ":)" - - operator fun setValue(thisRef: Any?, property: KProperty<*>, value: String) { - } - - operator fun propertyDelegated(property: KProperty<*>) { - } -} - -var p: String by Delegate() diff --git a/idea/testData/findUsages/kotlin/conventions/propertyDelegatedFunction.log b/idea/testData/findUsages/kotlin/conventions/propertyDelegatedFunction.log deleted file mode 100644 index 58f49f01c90..00000000000 --- a/idea/testData/findUsages/kotlin/conventions/propertyDelegatedFunction.log +++ /dev/null @@ -1,4 +0,0 @@ -Resolved by Delegate() -Searched references to Delegate -Used plain search of Delegate.propertyDelegated(property: KProperty<*>) in LocalSearchScope: - CLASS:Delegate diff --git a/idea/testData/findUsages/kotlin/conventions/propertyDelegatedFunction.results.txt b/idea/testData/findUsages/kotlin/conventions/propertyDelegatedFunction.results.txt deleted file mode 100644 index 51d6c96ddd4..00000000000 --- a/idea/testData/findUsages/kotlin/conventions/propertyDelegatedFunction.results.txt +++ /dev/null @@ -1 +0,0 @@ -Property delegation 16 var p: String by Delegate() \ No newline at end of file diff --git a/idea/testData/resolve/references/delegatedPropertyAccessors/inSource/getSetPropertyDelegatedExtension.kt b/idea/testData/resolve/references/delegatedPropertyAccessors/inSource/getSetPropertyDelegatedExtension.kt deleted file mode 100644 index 7fe10c34640..00000000000 --- a/idea/testData/resolve/references/delegatedPropertyAccessors/inSource/getSetPropertyDelegatedExtension.kt +++ /dev/null @@ -1,13 +0,0 @@ -var x: Int by Foo() - -class Foo - -fun Foo.getValue(_this: Any?, p: Any?): Int = 1 -fun Foo.setValue(_this: Any?, p: Any?, val: Any?) {} -fun Foo.propertyDelegated(p: Any?) {} - -// MULTIRESOLVE -// REF: (for Foo in ).getValue(Any?, Any?) -// REF: (for Foo in ).setValue(Any?, Any?, Any?) -// REF: (for Foo in ).propertyDelegated(Any?) - diff --git a/idea/testData/resolve/references/delegatedPropertyAccessors/inSource/getSetPropertyDelegatedMember.kt b/idea/testData/resolve/references/delegatedPropertyAccessors/inSource/getSetPropertyDelegatedMember.kt deleted file mode 100644 index 0be8aa638b6..00000000000 --- a/idea/testData/resolve/references/delegatedPropertyAccessors/inSource/getSetPropertyDelegatedMember.kt +++ /dev/null @@ -1,13 +0,0 @@ -var x: Int by Foo() - -class Foo { - fun getValue(_this: Any?, p: Any?): Int = 1 - fun setValue(_this: Any?, p: Any?, val: Any?) {} - fun propertyDelegated(p: Any?) -} - -// MULTIRESOLVE -// REF: (in Foo).getValue(Any?, Any?) -// REF: (in Foo).setValue(Any?, Any?, Any?) -// REF: (in Foo).propertyDelegated(Any?) - diff --git a/idea/tests/org/jetbrains/kotlin/findUsages/FindUsagesTestGenerated.java b/idea/tests/org/jetbrains/kotlin/findUsages/FindUsagesTestGenerated.java index e587edbbac8..8e6b0df1421 100644 --- a/idea/tests/org/jetbrains/kotlin/findUsages/FindUsagesTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/findUsages/FindUsagesTestGenerated.java @@ -145,12 +145,6 @@ public class FindUsagesTestGenerated extends AbstractFindUsagesTest { doTest(fileName); } - @TestMetadata("propertyDelegatedFunction.0.kt") - public void testPropertyDelegatedFunction() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("idea/testData/findUsages/kotlin/conventions/propertyDelegatedFunction.0.kt"); - doTest(fileName); - } - @TestMetadata("set.0.kt") public void testSet() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("idea/testData/findUsages/kotlin/conventions/set.0.kt"); diff --git a/idea/tests/org/jetbrains/kotlin/idea/resolve/ReferenceResolveTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/resolve/ReferenceResolveTestGenerated.java index 2f5cc7e4526..5351d348f50 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/resolve/ReferenceResolveTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/idea/resolve/ReferenceResolveTestGenerated.java @@ -519,18 +519,6 @@ public class ReferenceResolveTestGenerated extends AbstractReferenceResolveTest String fileName = KotlinTestUtils.navigationMetadata("idea/testData/resolve/references/delegatedPropertyAccessors/inSource/getOneFakeOverride.kt"); doTest(fileName); } - - @TestMetadata("getSetPropertyDelegatedExtension.kt") - public void testGetSetPropertyDelegatedExtension() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("idea/testData/resolve/references/delegatedPropertyAccessors/inSource/getSetPropertyDelegatedExtension.kt"); - doTest(fileName); - } - - @TestMetadata("getSetPropertyDelegatedMember.kt") - public void testGetSetPropertyDelegatedMember() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("idea/testData/resolve/references/delegatedPropertyAccessors/inSource/getSetPropertyDelegatedMember.kt"); - doTest(fileName); - } } @TestMetadata("idea/testData/resolve/references/delegatedPropertyAccessors/inStandardLibrary")