KT-6821 Go to reference on "by" keyword in delegated property doesn't navigate to propertyDelegated

#KT-6821 fixed
This commit is contained in:
Evgeny Gerashchenko
2015-03-04 19:31:49 +03:00
parent 9a17bce179
commit 0a824edace
4 changed files with 12 additions and 8 deletions
@@ -42,9 +42,9 @@ public class JetPropertyDelegationMethodsReference(element: JetPropertyDelegate)
if (descriptor !is PropertyDescriptor) { if (descriptor !is PropertyDescriptor) {
return Collections.emptyList() return Collections.emptyList()
} }
return descriptor.getAccessors().map { return (descriptor.getAccessors().map {
accessor -> accessor ->
context.get(BindingContext.DELEGATED_PROPERTY_RESOLVED_CALL, accessor)?.getCandidateDescriptor() context.get(BindingContext.DELEGATED_PROPERTY_RESOLVED_CALL, accessor)?.getCandidateDescriptor()
}.filterNotNull() } + listOf(context.get(BindingContext.DELEGATED_PROPERTY_PD_RESOLVED_CALL, descriptor)?.getCandidateDescriptor())).filterNotNull()
} }
} }
@@ -4,8 +4,10 @@ class Foo
fun Foo.get(_this: Any?, p: Any?): Int = 1 fun Foo.get(_this: Any?, p: Any?): Int = 1
fun Foo.set(_this: Any?, p: Any?, val: Any?) {} fun Foo.set(_this: Any?, p: Any?, val: Any?) {}
fun Foo.propertyDelegated(p: Any?) {}
// MULTIRESOLVE // MULTIRESOLVE
// REF: (for Foo in <root>).get(Any?,Any?) // REF: (for Foo in <root>).get(Any?,Any?)
// REF: (for Foo in <root>).set(Any?,Any?,Any?) // REF: (for Foo in <root>).set(Any?,Any?,Any?)
// REF: (for Foo in <root>).propertyDelegated(Any?)
@@ -3,9 +3,11 @@ var x: Int <caret>by Foo()
class Foo { class Foo {
fun get(_this: Any?, p: Any?): Int = 1 fun get(_this: Any?, p: Any?): Int = 1
fun set(_this: Any?, p: Any?, val: Any?) {} fun set(_this: Any?, p: Any?, val: Any?) {}
fun propertyDelegated(p: Any?)
} }
// MULTIRESOLVE // MULTIRESOLVE
// REF: (in Foo).get(Any?,Any?) // REF: (in Foo).get(Any?,Any?)
// REF: (in Foo).set(Any?,Any?,Any?) // REF: (in Foo).set(Any?,Any?,Any?)
// REF: (in Foo).propertyDelegated(Any?)
@@ -421,15 +421,15 @@ public class ReferenceResolveTestGenerated extends AbstractReferenceResolveTest
doTest(fileName); doTest(fileName);
} }
@TestMetadata("getSetExtension.kt") @TestMetadata("getSetPropertyDelegatedExtension.kt")
public void testGetSetExtension() throws Exception { public void testGetSetPropertyDelegatedExtension() throws Exception {
String fileName = JetTestUtils.navigationMetadata("idea/testData/resolve/references/delegatedPropertyAccessors/inSource/getSetExtension.kt"); String fileName = JetTestUtils.navigationMetadata("idea/testData/resolve/references/delegatedPropertyAccessors/inSource/getSetPropertyDelegatedExtension.kt");
doTest(fileName); doTest(fileName);
} }
@TestMetadata("getSetMember.kt") @TestMetadata("getSetPropertyDelegatedMember.kt")
public void testGetSetMember() throws Exception { public void testGetSetPropertyDelegatedMember() throws Exception {
String fileName = JetTestUtils.navigationMetadata("idea/testData/resolve/references/delegatedPropertyAccessors/inSource/getSetMember.kt"); String fileName = JetTestUtils.navigationMetadata("idea/testData/resolve/references/delegatedPropertyAccessors/inSource/getSetPropertyDelegatedMember.kt");
doTest(fileName); doTest(fileName);
} }
} }