resolve KDoc references to members of companion object

This commit is contained in:
Dmitry Jemerov
2015-11-20 18:21:32 +01:00
parent 6adfb96154
commit f20f15ec46
3 changed files with 28 additions and 2 deletions
@@ -138,10 +138,17 @@ private fun getClassInnerScope(outerScope: LexicalScope, descriptor: ClassDescri
addFunctionDescriptor(constructor)
}
}
val scopeChain = arrayListOf(descriptor.defaultType.memberScope,
descriptor.staticScope)
descriptor.companionObjectDescriptor?.let {
scopeChain.add(it.defaultType.memberScope)
}
return LexicalChainedScope(headerScope, descriptor, false, null,
"Class ${descriptor.name} scope",
descriptor.defaultType.memberScope,
descriptor.staticScope)
*scopeChain.toTypedArray())
}
public fun getResolutionScope(resolutionFacade: ResolutionFacade, descriptor: DeclarationDescriptor): LexicalScope {
+13
View File
@@ -0,0 +1,13 @@
/** See [Foo.b<caret>ar] */
class T {
}
class Foo {
companion object {
fun bar() {
}
}
}
// REF: (in Foo.Companion).bar()
@@ -60,6 +60,12 @@ public class KdocResolveTestGenerated extends AbstractReferenceResolveTest {
doTest(fileName);
}
@TestMetadata("CompanionObjectMember.kt")
public void testCompanionObjectMember() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/kdoc/resolve/CompanionObjectMember.kt");
doTest(fileName);
}
@TestMetadata("ConstructorParamReference.kt")
public void testConstructorParamReference() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/kdoc/resolve/ConstructorParamReference.kt");