Supported access to companion object members
This commit is contained in:
+6
@@ -377,6 +377,12 @@ private class Processor(
|
||||
return true // this@ClassName - it will be handled anyway because members and extensions are processed with plain search
|
||||
}
|
||||
}
|
||||
|
||||
is KtQualifiedExpression -> {
|
||||
if (element == parent.receiverExpression) {
|
||||
return true // companion object member or static member access - ignore it
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (element.getStrictParentOfType<KtImportDirective>() != null) return true // ignore usage in import
|
||||
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtParameter
|
||||
// OPTIONS: usages
|
||||
|
||||
data class A(val <caret>x: Int, val y: Int) {
|
||||
companion object {
|
||||
fun b(): B = B()
|
||||
}
|
||||
}
|
||||
|
||||
data class B(val x: Int, val y: Int)
|
||||
|
||||
fun foo() {
|
||||
val (x, y) = A.b()
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
Searched inheritors of A
|
||||
Searched references to A
|
||||
Used plain search in LocalSearchScope:
|
||||
CLASS:A
|
||||
+1
@@ -0,0 +1 @@
|
||||
|
||||
@@ -170,6 +170,12 @@ public class FindUsagesTestGenerated extends AbstractFindUsagesTest {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/findUsages/kotlin/conventions/components"), Pattern.compile("^(.+)\\.0\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("companionObjectAccess.0.kt")
|
||||
public void testCompanionObjectAccess() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/findUsages/kotlin/conventions/components/companionObjectAccess.0.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("componentFunForGenericType1.0.kt")
|
||||
public void testComponentFunForGenericType1() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/findUsages/kotlin/conventions/components/componentFunForGenericType1.0.kt");
|
||||
|
||||
Reference in New Issue
Block a user