mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[kotlin] kmp find usages: implicit component usages
KtDestructuringDeclarationReference has component as second target, thus we need to check all of them ^KTIJ-29947 fixed GitOrigin-RevId: a743a6453bc55f2051ebbfdc4a67e7c00202f91f
This commit is contained in:
committed by
intellij-monorepo-bot
parent
20da499432
commit
9ca963f886
+3
-2
@@ -67,9 +67,10 @@ abstract class OperatorReferenceSearcher<TReferenceElement : KtElement>(
|
||||
return consumer.process(reference)
|
||||
}
|
||||
|
||||
val currentTarget = reference.resolve() as? KtDeclaration ?: return true
|
||||
val currentTargets = (reference as? PsiPolyVariantReference)?.multiResolve(false)?.mapNotNull { it.element as? KtDeclaration } ?: return true
|
||||
if (targetDeclaration !is KtDeclaration) return true
|
||||
return if ((targetDeclaration.expectedDeclarationIfAny() ?: targetDeclaration) == (currentTarget.expectedDeclarationIfAny() ?: currentTarget)
|
||||
val expectedTarget = targetDeclaration.expectedDeclarationIfAny() ?: targetDeclaration
|
||||
return if (expectedTarget in currentTargets.map { it.expectedDeclarationIfAny() ?: it }
|
||||
) {
|
||||
consumer.process(reference)
|
||||
} else {
|
||||
|
||||
+10
@@ -73,6 +73,16 @@ public class FindUsagesMultiModuleFirTestGenerated extends AbstractFindUsagesMul
|
||||
runTest("../../idea/tests/testData/multiModuleFindUsages/findCompanionObjectUsages/");
|
||||
}
|
||||
|
||||
@TestMetadata("findComponentsByConventionInCommon")
|
||||
public void testFindComponentsByConventionInCommon() throws Exception {
|
||||
runTest("../../idea/tests/testData/multiModuleFindUsages/findComponentsByConventionInCommon/");
|
||||
}
|
||||
|
||||
@TestMetadata("findComponentsByConventionInPlatform")
|
||||
public void testFindComponentsByConventionInPlatform() throws Exception {
|
||||
runTest("../../idea/tests/testData/multiModuleFindUsages/findComponentsByConventionInPlatform/");
|
||||
}
|
||||
|
||||
@TestMetadata("findDataComponentInJs")
|
||||
public void testFindDataComponentInJs() throws Exception {
|
||||
runTest("../../idea/tests/testData/multiModuleFindUsages/findDataComponentInJs/");
|
||||
|
||||
+10
@@ -73,6 +73,16 @@ public class FindUsagesMultiModuleTestGenerated extends AbstractFindUsagesMultiM
|
||||
runTest("testData/multiModuleFindUsages/findCompanionObjectUsages/");
|
||||
}
|
||||
|
||||
@TestMetadata("findComponentsByConventionInCommon")
|
||||
public void testFindComponentsByConventionInCommon() throws Exception {
|
||||
runTest("testData/multiModuleFindUsages/findComponentsByConventionInCommon/");
|
||||
}
|
||||
|
||||
@TestMetadata("findComponentsByConventionInPlatform")
|
||||
public void testFindComponentsByConventionInPlatform() throws Exception {
|
||||
runTest("testData/multiModuleFindUsages/findComponentsByConventionInPlatform/");
|
||||
}
|
||||
|
||||
@TestMetadata("findDataComponentInJs")
|
||||
public void testFindDataComponentInJs() throws Exception {
|
||||
runTest("testData/multiModuleFindUsages/findDataComponentInJs/");
|
||||
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtFunction
|
||||
// OPTIONS: usages, expected
|
||||
class DummyClass001
|
||||
expect operator fun DummyClass001.comp<caret>onent1()
|
||||
expect operator fun DummyClass001.component2()
|
||||
fun testDummyClass001() {
|
||||
val (a, b) = DummyClass001()
|
||||
DummyClass001().component1()
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
[common.kt] Function call 8 DummyClass001().component1()
|
||||
[common.kt] Value read 7 val (a, b) = DummyClass001()
|
||||
[js.kt] Function call 5 DummyClass001().component1()
|
||||
[js.kt] Value read 4 val (a, b) = DummyClass001()
|
||||
[jvm.kt] Function call 5 DummyClass001().component1()
|
||||
[jvm.kt] Value read 4 val (a, b) = DummyClass001()
|
||||
+1
@@ -0,0 +1 @@
|
||||
// IGNORE_K1
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
actual operator fun DummyClass001.component1() {}
|
||||
actual operator fun DummyClass001.component2() {}
|
||||
fun testDummyClass001Js() {
|
||||
val (a, b) = DummyClass001()
|
||||
DummyClass001().component1()
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
actual operator fun DummyClass001.component1() {}
|
||||
actual operator fun DummyClass001.component2() {}
|
||||
fun testDummyClass001Jvm() {
|
||||
val (a, b) = DummyClass001()
|
||||
DummyClass001().component1()
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
class DummyClass001
|
||||
expect operator fun DummyClass001.component1()
|
||||
expect operator fun DummyClass001.component2()
|
||||
fun testDummyClass001() {
|
||||
val (a, b) = DummyClass001()
|
||||
DummyClass001().component1()
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
// IGNORE_K1
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtFunction
|
||||
// OPTIONS: usages, expected
|
||||
actual operator fun DummyClass001.compo<caret>nent1() {}
|
||||
actual operator fun DummyClass001.component2() {}
|
||||
fun testDummyClass001Js() {
|
||||
val (a, b) = DummyClass001()
|
||||
DummyClass001().component1()
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
[common.kt] Function call 6 DummyClass001().component1()
|
||||
[common.kt] Value read 5 val (a, b) = DummyClass001()
|
||||
[js.kt] Function call 7 DummyClass001().component1()
|
||||
[js.kt] Value read 6 val (a, b) = DummyClass001()
|
||||
[jvm.kt] Function call 5 DummyClass001().component1()
|
||||
[jvm.kt] Value read 4 val (a, b) = DummyClass001()
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
actual operator fun DummyClass001.component1() {}
|
||||
actual operator fun DummyClass001.component2() {}
|
||||
fun testDummyClass001Jvm() {
|
||||
val (a, b) = DummyClass001()
|
||||
DummyClass001().component1()
|
||||
}
|
||||
Reference in New Issue
Block a user