[FIR] Ensure qualifier resolution takes place for type aliases.
When resolving a name that is used as a receiver and all candidates are classifier symbols, we need to perform qualifier resolution. The code used to only do that for regular classes, and would not perform qualifier resolution if there was a type alias candidate. ^KT-51171 Fixed
This commit is contained in:
+6
@@ -40821,6 +40821,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
runTest("compiler/testData/codegen/box/regressions/kt5056.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt51171.kt")
|
||||
public void testKt51171() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/regressions/kt51171.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt528.kt")
|
||||
public void testKt528() throws Exception {
|
||||
|
||||
@@ -268,7 +268,7 @@ class FirCallResolver(
|
||||
// A // should resolved to D.A
|
||||
// A.B // should be resolved to A.B
|
||||
// }
|
||||
if (!result.applicability.isSuccess || (isUsedAsReceiver && result.candidates.all { it.symbol is FirRegularClassSymbol })) {
|
||||
if (!result.applicability.isSuccess || (isUsedAsReceiver && result.candidates.all { it.symbol is FirClassifierSymbol })) {
|
||||
components.resolveRootPartOfQualifier(
|
||||
callee, qualifiedAccess.source, qualifiedAccess.typeArguments, nonFatalDiagnosticFromExpression,
|
||||
)?.let { return it }
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
|
||||
// FILE: Error.java
|
||||
|
||||
public class Error {
|
||||
static String foo() {
|
||||
return "OK";
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: test.kt
|
||||
|
||||
fun box() = Error.foo()
|
||||
+6
@@ -40359,6 +40359,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
runTest("compiler/testData/codegen/box/regressions/kt5056.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt51171.kt")
|
||||
public void testKt51171() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/regressions/kt51171.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt528.kt")
|
||||
public void testKt528() throws Exception {
|
||||
|
||||
+6
@@ -40821,6 +40821,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
runTest("compiler/testData/codegen/box/regressions/kt5056.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt51171.kt")
|
||||
public void testKt51171() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/regressions/kt51171.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt528.kt")
|
||||
public void testKt528() throws Exception {
|
||||
|
||||
+5
@@ -32460,6 +32460,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
runTest("compiler/testData/codegen/box/regressions/kt5056.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt51171.kt")
|
||||
public void testKt51171() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/regressions/kt51171.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt528.kt")
|
||||
public void testKt528() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/regressions/kt528.kt");
|
||||
|
||||
Reference in New Issue
Block a user