[kotlin] k2: find usages: overloads detection

- reject functions with different receivers
- accept function without receiver and function with any receiver on the same nesting level

^KTIJ-28396 fixed
^KTIJ-26220 fixed

GitOrigin-RevId: 3a189bf3c7ff559a8a3320ed6d5a6dcdc76c9680
This commit is contained in:
Anna Kozlova
2024-03-06 22:09:03 +01:00
committed by intellij-monorepo-bot
parent 564f680ed5
commit 68006546c0
16 changed files with 325 additions and 14 deletions

View File

@@ -1903,6 +1903,71 @@ public abstract class FindUsagesWithCompilerReferenceIndexFirTestGenerated exten
}
}
@RunWith(JUnit3RunnerWithInners.class)
@TestMetadata("../../idea/tests/testData/findUsages/kotlin/findFunctionUsages")
public static class TestKotlinOverloadAndExtensionUsagesSameClass extends AbstractFindUsagesWithCompilerReferenceIndexFirTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
@TestMetadata("kotlinOverloadAndExtensionUsagesSameClass.0.kt")
public void testKotlinOverloadAndExtensionUsagesSameClass() throws Exception {
runTest("../../idea/tests/testData/findUsages/kotlin/findFunctionUsages/kotlinOverloadAndExtensionUsagesSameClass.0.kt");
}
}
@RunWith(JUnit3RunnerWithInners.class)
@TestMetadata("../../idea/tests/testData/findUsages/kotlin/findFunctionUsages")
public static class TestKotlinOverloadAndExtensionUsagesTopLevel extends AbstractFindUsagesWithCompilerReferenceIndexFirTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
@TestMetadata("kotlinOverloadAndExtensionUsagesTopLevel.0.kt")
public void testKotlinOverloadAndExtensionUsagesTopLevel() throws Exception {
runTest("../../idea/tests/testData/findUsages/kotlin/findFunctionUsages/kotlinOverloadAndExtensionUsagesTopLevel.0.kt");
}
}
@RunWith(JUnit3RunnerWithInners.class)
@TestMetadata("../../idea/tests/testData/findUsages/kotlin/findFunctionUsages")
public static class TestKotlinOverloadAndExtensionUsagesTopLevelDifferentReceivers extends AbstractFindUsagesWithCompilerReferenceIndexFirTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
@TestMetadata("kotlinOverloadAndExtensionUsagesTopLevelDifferentReceivers.0.kt")
public void testKotlinOverloadAndExtensionUsagesTopLevelDifferentReceivers() throws Exception {
runTest("../../idea/tests/testData/findUsages/kotlin/findFunctionUsages/kotlinOverloadAndExtensionUsagesTopLevelDifferentReceivers.0.kt");
}
}
@RunWith(JUnit3RunnerWithInners.class)
@TestMetadata("../../idea/tests/testData/findUsages/kotlin/findFunctionUsages")
public static class TestKotlinOverloadAndExtensionUsagesTopLevelExtension extends AbstractFindUsagesWithCompilerReferenceIndexFirTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
@TestMetadata("kotlinOverloadAndExtensionUsagesTopLevelExtension.0.kt")
public void testKotlinOverloadAndExtensionUsagesTopLevelExtension() throws Exception {
runTest("../../idea/tests/testData/findUsages/kotlin/findFunctionUsages/kotlinOverloadAndExtensionUsagesTopLevelExtension.0.kt");
}
}
@RunWith(JUnit3RunnerWithInners.class)
@TestMetadata("../../idea/tests/testData/findUsages/kotlin/findFunctionUsages")
public static class TestKotlinOverloadAndExtensionUsagesTopLevelVsInstance extends AbstractFindUsagesWithCompilerReferenceIndexFirTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
@TestMetadata("kotlinOverloadAndExtensionUsagesTopLevelVsInstance.0.kt")
public void testKotlinOverloadAndExtensionUsagesTopLevelVsInstance() throws Exception {
runTest("../../idea/tests/testData/findUsages/kotlin/findFunctionUsages/kotlinOverloadAndExtensionUsagesTopLevelVsInstance.0.kt");
}
}
@RunWith(JUnit3RunnerWithInners.class)
@TestMetadata("../../idea/tests/testData/findUsages/kotlin/findFunctionUsages")
public static class TestKotlinPrivateMethodUsages extends AbstractFindUsagesWithCompilerReferenceIndexFirTest {

View File

@@ -1903,6 +1903,71 @@ public abstract class FindUsagesWithCompilerReferenceIndexTestGenerated extends
}
}
@RunWith(JUnit3RunnerWithInners.class)
@TestMetadata("../../idea/tests/testData/findUsages/kotlin/findFunctionUsages")
public static class TestKotlinOverloadAndExtensionUsagesSameClass extends AbstractFindUsagesWithCompilerReferenceIndexTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
@TestMetadata("kotlinOverloadAndExtensionUsagesSameClass.0.kt")
public void testKotlinOverloadAndExtensionUsagesSameClass() throws Exception {
runTest("../../idea/tests/testData/findUsages/kotlin/findFunctionUsages/kotlinOverloadAndExtensionUsagesSameClass.0.kt");
}
}
@RunWith(JUnit3RunnerWithInners.class)
@TestMetadata("../../idea/tests/testData/findUsages/kotlin/findFunctionUsages")
public static class TestKotlinOverloadAndExtensionUsagesTopLevel extends AbstractFindUsagesWithCompilerReferenceIndexTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
@TestMetadata("kotlinOverloadAndExtensionUsagesTopLevel.0.kt")
public void testKotlinOverloadAndExtensionUsagesTopLevel() throws Exception {
runTest("../../idea/tests/testData/findUsages/kotlin/findFunctionUsages/kotlinOverloadAndExtensionUsagesTopLevel.0.kt");
}
}
@RunWith(JUnit3RunnerWithInners.class)
@TestMetadata("../../idea/tests/testData/findUsages/kotlin/findFunctionUsages")
public static class TestKotlinOverloadAndExtensionUsagesTopLevelDifferentReceivers extends AbstractFindUsagesWithCompilerReferenceIndexTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
@TestMetadata("kotlinOverloadAndExtensionUsagesTopLevelDifferentReceivers.0.kt")
public void testKotlinOverloadAndExtensionUsagesTopLevelDifferentReceivers() throws Exception {
runTest("../../idea/tests/testData/findUsages/kotlin/findFunctionUsages/kotlinOverloadAndExtensionUsagesTopLevelDifferentReceivers.0.kt");
}
}
@RunWith(JUnit3RunnerWithInners.class)
@TestMetadata("../../idea/tests/testData/findUsages/kotlin/findFunctionUsages")
public static class TestKotlinOverloadAndExtensionUsagesTopLevelExtension extends AbstractFindUsagesWithCompilerReferenceIndexTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
@TestMetadata("kotlinOverloadAndExtensionUsagesTopLevelExtension.0.kt")
public void testKotlinOverloadAndExtensionUsagesTopLevelExtension() throws Exception {
runTest("../../idea/tests/testData/findUsages/kotlin/findFunctionUsages/kotlinOverloadAndExtensionUsagesTopLevelExtension.0.kt");
}
}
@RunWith(JUnit3RunnerWithInners.class)
@TestMetadata("../../idea/tests/testData/findUsages/kotlin/findFunctionUsages")
public static class TestKotlinOverloadAndExtensionUsagesTopLevelVsInstance extends AbstractFindUsagesWithCompilerReferenceIndexTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
@TestMetadata("kotlinOverloadAndExtensionUsagesTopLevelVsInstance.0.kt")
public void testKotlinOverloadAndExtensionUsagesTopLevelVsInstance() throws Exception {
runTest("../../idea/tests/testData/findUsages/kotlin/findFunctionUsages/kotlinOverloadAndExtensionUsagesTopLevelVsInstance.0.kt");
}
}
@RunWith(JUnit3RunnerWithInners.class)
@TestMetadata("../../idea/tests/testData/findUsages/kotlin/findFunctionUsages")
public static class TestKotlinPrivateMethodUsages extends AbstractFindUsagesWithCompilerReferenceIndexTest {