KT-62695 [AA] Better resolve ambiguous receiver types in KDocReferenceResolver

When encountering multiple available same named types,
resolve all of them together with corresponding extensions.
This aligns well with the current resolve behavior of classes
with the same name (see `SameNameClassesFromStarImports.kt`)

Also, add extra test for resolving the ambiguous type without
the extension function. The behavior is the same - resolve to the
both classes.
This commit is contained in:
Roman Golyshev
2024-01-24 23:45:10 +01:00
committed by Space Team
parent e5c6a5bac3
commit d45662c2c3
12 changed files with 266 additions and 7 deletions
@@ -1486,6 +1486,18 @@ public class FirStandaloneNormalAnalysisSourceModuleReferenceResolveTestGenerate
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/extensions/qualifiers.kt");
}
@Test
@TestMetadata("receiverTypesWithSameName_nestedScopes.kt")
public void testReceiverTypesWithSameName_nestedScopes() throws Exception {
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/extensions/receiverTypesWithSameName_nestedScopes.kt");
}
@Test
@TestMetadata("receiverTypesWithSameName_starImports.kt")
public void testReceiverTypesWithSameName_starImports() throws Exception {
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/extensions/receiverTypesWithSameName_starImports.kt");
}
@Test
@TestMetadata("topLevelFunction.kt")
public void testTopLevelFunction() throws Exception {
@@ -1554,6 +1566,12 @@ public class FirStandaloneNormalAnalysisSourceModuleReferenceResolveTestGenerate
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/referenceResolve/kDoc/imports"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
}
@Test
@TestMetadata("SameNameClassesFromStarImports.kt")
public void testSameNameClassesFromStarImports() throws Exception {
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/imports/SameNameClassesFromStarImports.kt");
}
@Test
@TestMetadata("TypeAliasedImport.kt")
public void testTypeAliasedImport() throws Exception {