[LL API] Fix code fragment compilation in library sources (KT-61383)

In complex projects, there might be several library copies (with the
same or different versions). As there is no way to build a reliable
dependency graph between libraries, a project library depends on all
other libraries. As a result, there might be several declarations in the
classpath with the same name and signature.

Normally, K2 issues a 'resolution ambiguity' error on calls to such
libraries. It is acceptable for resolution, as resolution errors are
never shown in the library code. However, the backend, to which
'evaluate expression' needs to pass FIR afterwards, is not designed for
compiling ambiguous (and non-completed) calls.
This commit is contained in:
Yan Zhulanow
2023-08-22 16:48:28 +09:00
committed by Space Team
parent 4b80c2197f
commit b96c1a644f
9 changed files with 184 additions and 2 deletions
@@ -85,6 +85,12 @@ public class FirIdeNormalAnalysisLibrarySourceModuleCompilerFacilityTestGenerate
runTest("analysis/analysis-api/testData/components/compilerFacility/compilation/codeFragments/customName.kt");
}
@Test
@TestMetadata("duplicateLibrary.kt")
public void testDuplicateLibrary() throws Exception {
runTest("analysis/analysis-api/testData/components/compilerFacility/compilation/codeFragments/duplicateLibrary.kt");
}
@Test
@TestMetadata("imports.kt")
public void testImports() throws Exception {
@@ -85,6 +85,12 @@ public class FirIdeNormalAnalysisSourceModuleCompilerFacilityTestGenerated exten
runTest("analysis/analysis-api/testData/components/compilerFacility/compilation/codeFragments/customName.kt");
}
@Test
@TestMetadata("duplicateLibrary.kt")
public void testDuplicateLibrary() throws Exception {
runTest("analysis/analysis-api/testData/components/compilerFacility/compilation/codeFragments/duplicateLibrary.kt");
}
@Test
@TestMetadata("imports.kt")
public void testImports() throws Exception {