MPP navigation / search: handle expect objects correctly #KT-25317 Fixed

This commit is contained in:
Mikhail Glukhikh
2018-07-24 12:33:58 +03:00
parent 82f64b9b14
commit 26b57c6250
9 changed files with 52 additions and 1 deletions
@@ -53,6 +53,10 @@ class KotlinDefinitionsSearcher : QueryExecutor<PsiElement, DefinitionsScopedSea
processClassImplementations(element, consumer) && processActualDeclarations(element, consumer)
}
is KtObjectDeclaration -> {
processActualDeclarations(element, consumer)
}
is KtLightClass -> {
val useScope = runReadAction { element.useScope }
if (useScope is LocalSearchScope)
@@ -0,0 +1,10 @@
package test
expect class Owner {
companion <caret>object {
}
}
// REF: companion object of [testModule_JVM] (test).Owner
// REF: companion object of [testModule_JS] (test).Owner
@@ -0,0 +1,7 @@
package test
actual class Owner {
actual companion object {
}
}
@@ -0,0 +1,7 @@
package test
actual class Owner {
actual companion object {
}
}
@@ -0,0 +1,7 @@
package test
expect object <caret>Obj
// REF: [testModule_JVM] (test).Obj
// REF: [testModule_JS] (test).Obj
@@ -0,0 +1,3 @@
package test
actual object Obj
@@ -0,0 +1,3 @@
package test
actual object Obj
@@ -59,6 +59,16 @@ public class KotlinGotoImplementationMultiModuleTestGenerated extends AbstractKo
runTest("idea/testData/navigation/implementations/multiModule/expectClassSuperclassProperty/");
}
@TestMetadata("expectCompanion")
public void testExpectCompanion() throws Exception {
runTest("idea/testData/navigation/implementations/multiModule/expectCompanion/");
}
@TestMetadata("expectObject")
public void testExpectObject() throws Exception {
runTest("idea/testData/navigation/implementations/multiModule/expectObject/");
}
@TestMetadata("suspendFunImpl")
public void testSuspendFunImpl() throws Exception {
runTest("idea/testData/navigation/implementations/multiModule/suspendFunImpl/");
@@ -37,7 +37,7 @@ fun PsiElement.renderAsGotoImplementation(renderModule: Boolean = false): String
if (navigationElement is KtObjectDeclaration && navigationElement.isCompanion()) {
//default presenter return null for companion object
val containingClass = PsiTreeUtil.getParentOfType(navigationElement, KtClass::class.java)!!
return "companion object of " + containingClass.renderAsGotoImplementation()
return "companion object of " + containingClass.renderAsGotoImplementation(renderModule)
}
if (navigationElement is KtStringTemplateExpression) {