K2: add test for KT-56520, case (7), qualifier receivers (3)
This commit covers object vs static member case, when no companion objects are in the scope. K1 reports UNRESOLVED_REFERENCE here, probably due to ambiguity. About K2, while resolving Some.foo it first tries to resolve Some as a "general" variable access, and gets two erroneous candidates without companions. After it tries to resolve Some as a qualifier, but we have no scope with a single qualifier. That's why we finally report NONE_APPLICABLE on candidates with companions.
This commit is contained in:
committed by
Space Team
parent
602801dcfd
commit
76b2b9fc66
+6
@@ -44797,6 +44797,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/qualifierForStaticCase.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("qualifierOrStaticObjectCase.kt")
|
||||
public void testQualifierOrStaticObjectCase() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/qualifierOrStaticObjectCase.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("qualifierStaticObjectOrCompanionMemberCase.kt")
|
||||
public void testQualifierStaticObjectOrCompanionMemberCase() throws Exception {
|
||||
|
||||
+6
@@ -44797,6 +44797,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/qualifierForStaticCase.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("qualifierOrStaticObjectCase.kt")
|
||||
public void testQualifierOrStaticObjectCase() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/qualifierOrStaticObjectCase.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("qualifierStaticObjectOrCompanionMemberCase.kt")
|
||||
public void testQualifierStaticObjectOrCompanionMemberCase() throws Exception {
|
||||
|
||||
+6
@@ -42675,6 +42675,12 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/qualifierForStaticCase.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("qualifierOrStaticObjectCase.kt")
|
||||
public void testQualifierOrStaticObjectCase() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/qualifierOrStaticObjectCase.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("qualifierStaticObjectOrCompanionMemberCase.kt")
|
||||
public void testQualifierStaticObjectOrCompanionMemberCase() throws Exception {
|
||||
|
||||
+6
@@ -42795,6 +42795,12 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/qualifierForStaticCase.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("qualifierOrStaticObjectCase.kt")
|
||||
public void testQualifierOrStaticObjectCase() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/qualifierOrStaticObjectCase.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("qualifierStaticObjectOrCompanionMemberCase.kt")
|
||||
public void testQualifierStaticObjectOrCompanionMemberCase() throws Exception {
|
||||
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
// ISSUE: KT-56520 (case 7, object vs static member, no companions in scope)
|
||||
// FIR_DUMP
|
||||
|
||||
// FILE: some/Some.kt
|
||||
package some
|
||||
|
||||
class Some {
|
||||
object foo {} // (1)
|
||||
|
||||
// companion object {}
|
||||
}
|
||||
|
||||
// FILE: some3/Some.java
|
||||
package some3;
|
||||
|
||||
public class Some {
|
||||
public static int foo = 3; // (3)
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
import some.*
|
||||
import some3.*
|
||||
|
||||
fun test() = <!NONE_APPLICABLE!>Some<!>.<!UNRESOLVED_REFERENCE!>foo<!>
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
FILE: Some.kt
|
||||
package some
|
||||
|
||||
public final class Some : R|kotlin/Any| {
|
||||
public constructor(): R|some/Some| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final object foo : R|kotlin/Any| {
|
||||
private constructor(): R|some/Some.foo| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
FILE: main.kt
|
||||
public final fun test(): <ERROR TYPE REF: Unresolved name: foo> {
|
||||
^test <Ambiguity: Some, [some/Some, some3/Some]>#.<Unresolved name: foo>#
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
// ISSUE: KT-56520 (case 7, object vs static member, no companions in scope)
|
||||
// FIR_DUMP
|
||||
|
||||
// FILE: some/Some.kt
|
||||
package some
|
||||
|
||||
class Some {
|
||||
object foo {} // (1)
|
||||
|
||||
// companion object {}
|
||||
}
|
||||
|
||||
// FILE: some3/Some.java
|
||||
package some3;
|
||||
|
||||
public class Some {
|
||||
public static int foo = 3; // (3)
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
import some.*
|
||||
import some3.*
|
||||
|
||||
fun test() = <!UNRESOLVED_REFERENCE!>Some<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>foo<!>
|
||||
Generated
+6
@@ -44855,6 +44855,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/qualifierForStaticCase.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("qualifierOrStaticObjectCase.kt")
|
||||
public void testQualifierOrStaticObjectCase() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/resolve/ambiguousTypeReferences/qualifierOrStaticObjectCase.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("qualifierStaticObjectOrCompanionMemberCase.kt")
|
||||
public void testQualifierStaticObjectOrCompanionMemberCase() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user