K2: add test for KT-56520, case (2), constructors

In this test, K1 resolves to kotlin.collections.HashMap /* = java.util.HashMap */
K2 does the similar, but fun processConstructors from ConstructorProcessing.kt
makes a type alias substitution, so in fact constructor of expanded
java.util.HashMap is processed.

Pay attention that both frontends ignore some.HashMap and java.util.HashMap
due to ambiguous classifiers in explicit star importing scope.
See FirScope.processConstructorsByName in ConstructorProcessing.kt
This commit is contained in:
Mikhail Glukhikh
2023-10-26 11:57:05 +02:00
committed by Space Team
parent 0713866c1e
commit 6049f8657b
8 changed files with 184 additions and 0 deletions
@@ -44751,6 +44751,22 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
public void testSameNameClassesFromSupertypes() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/resolve/sameNameClassesFromSupertypes.kt");
}
@Nested
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences")
@TestDataPath("$PROJECT_ROOT")
public class AmbiguousTypeReferences {
@Test
public void testAllFilesPresentInAmbiguousTypeReferences() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences"), Pattern.compile("^(.+)\\.(kt|kts)$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), true);
}
@Test
@TestMetadata("constructorCase.kt")
public void testConstructorCase() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/constructorCase.kt");
}
}
}
@Nested
@@ -44751,6 +44751,22 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
public void testSameNameClassesFromSupertypes() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/resolve/sameNameClassesFromSupertypes.kt");
}
@Nested
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences")
@TestDataPath("$PROJECT_ROOT")
public class AmbiguousTypeReferences {
@Test
public void testAllFilesPresentInAmbiguousTypeReferences() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences"), Pattern.compile("^(.+)\\.(kt|kts)$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), true);
}
@Test
@TestMetadata("constructorCase.kt")
public void testConstructorCase() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/constructorCase.kt");
}
}
}
@Nested