FIR: Fix incorrect qualifier resolution in case of type parameters

^KT-51265 Fixed
This commit is contained in:
Denis.Zharkov
2022-02-14 14:20:37 +03:00
committed by teamcity
parent 52c8b6166c
commit 58408d8a78
6 changed files with 39 additions and 1 deletions
@@ -40839,6 +40839,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
runTest("compiler/testData/codegen/box/regressions/kt51171.kt");
}
@Test
@TestMetadata("kt51265.kt")
public void testKt51265() throws Exception {
runTest("compiler/testData/codegen/box/regressions/kt51265.kt");
}
@Test
@TestMetadata("kt528.kt")
public void testKt528() throws Exception {
@@ -308,7 +308,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 FirClassifierSymbol })) {
if (!result.applicability.isSuccess || (isUsedAsReceiver && result.candidates.all { it.symbol is FirClassLikeSymbol })) {
components.resolveRootPartOfQualifier(
callee, qualifiedAccess.source, qualifiedAccess.typeArguments, nonFatalDiagnosticFromExpression,
)?.let { return it }
+15
View File
@@ -0,0 +1,15 @@
// TARGET_BACKEND: JVM
// WITH_REFLECT
import kotlin.reflect.KClass
class OK
class T
inline fun <reified F : Any> bar(k: KClass<out F>): String = k.simpleName!!
inline fun <reified T : Any> foo(): String = bar(T::class)
fun box(): String {
return foo<OK>()
}
@@ -40377,6 +40377,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
runTest("compiler/testData/codegen/box/regressions/kt51171.kt");
}
@Test
@TestMetadata("kt51265.kt")
public void testKt51265() throws Exception {
runTest("compiler/testData/codegen/box/regressions/kt51265.kt");
}
@Test
@TestMetadata("kt528.kt")
public void testKt528() throws Exception {
@@ -40839,6 +40839,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
runTest("compiler/testData/codegen/box/regressions/kt51171.kt");
}
@Test
@TestMetadata("kt51265.kt")
public void testKt51265() throws Exception {
runTest("compiler/testData/codegen/box/regressions/kt51265.kt");
}
@Test
@TestMetadata("kt528.kt")
public void testKt528() throws Exception {
@@ -32475,6 +32475,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
runTest("compiler/testData/codegen/box/regressions/kt51171.kt");
}
@TestMetadata("kt51265.kt")
public void testKt51265() throws Exception {
runTest("compiler/testData/codegen/box/regressions/kt51265.kt");
}
@TestMetadata("kt528.kt")
public void testKt528() throws Exception {
runTest("compiler/testData/codegen/box/regressions/kt528.kt");