K2: add test for KT-56520, case (4), callable references (unbound)

Again, both frontends here ignored classifiers from
explicit star imported scope (some.HashMap, java.util.HashMap)
because of their ambiguity. In case of K2, it works so due to logic
in BodyResolveComponents.resolveRootPartOfQualifier.
This function is called to resolve qualifier without receiver.
See also cases (3) and (7).
This commit is contained in:
Mikhail Glukhikh
2023-10-30 11:41:15 +01:00
committed by Space Team
parent f0058ee0d8
commit c2ac9daa7f
7 changed files with 54 additions and 0 deletions
@@ -44767,6 +44767,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
runTest("compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/callableReferenceCase.kt");
}
@Test
@TestMetadata("callableReferenceUnboundCase.kt")
public void testCallableReferenceUnboundCase() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/callableReferenceUnboundCase.kt");
}
@Test
@TestMetadata("classLiteralCase.kt")
public void testClassLiteralCase() throws Exception {
@@ -44767,6 +44767,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
runTest("compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/callableReferenceCase.kt");
}
@Test
@TestMetadata("callableReferenceUnboundCase.kt")
public void testCallableReferenceUnboundCase() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/callableReferenceUnboundCase.kt");
}
@Test
@TestMetadata("classLiteralCase.kt")
public void testClassLiteralCase() throws Exception {
@@ -42645,6 +42645,12 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
runTest("compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/callableReferenceCase.kt");
}
@Test
@TestMetadata("callableReferenceUnboundCase.kt")
public void testCallableReferenceUnboundCase() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/callableReferenceUnboundCase.kt");
}
@Test
@TestMetadata("classLiteralCase.kt")
public void testClassLiteralCase() throws Exception {
@@ -42765,6 +42765,12 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
runTest("compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/callableReferenceCase.kt");
}
@Test
@TestMetadata("callableReferenceUnboundCase.kt")
public void testCallableReferenceUnboundCase() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/callableReferenceUnboundCase.kt");
}
@Test
@TestMetadata("classLiteralCase.kt")
public void testClassLiteralCase() throws Exception {
@@ -0,0 +1,4 @@
FILE: test.kt
public final fun test(): R|kotlin/reflect/KProperty1<kotlin/collections/HashMap<kotlin/String, kotlin/String>, kotlin/Int>| {
^test Q|kotlin/collections/HashMap|::R|SubstitutionOverride<java/util/HashMap.size: R|kotlin/Int|>|
}
@@ -0,0 +1,20 @@
// FIR_IDENTICAL
// ISSUE: KT-56520 (case 4, unbound)
// FIR_DUMP
// FULL_JDK
// FILE: some/HashMap.java
package some;
public class HashMap<K, V> extends java.util.HashMap<K, V> {}
// FILE: test.kt
import java.util.*
import some.*
fun test() =
// Ok in both K1 & K2.
// K1 & K2 resolve this to kotlin.collections.HashMap.
HashMap<String, String>::size
@@ -44825,6 +44825,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
runTest("compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/callableReferenceCase.kt");
}
@Test
@TestMetadata("callableReferenceUnboundCase.kt")
public void testCallableReferenceUnboundCase() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/callableReferenceUnboundCase.kt");
}
@Test
@TestMetadata("classLiteralCase.kt")
public void testClassLiteralCase() throws Exception {