[FIR2IR] Expand typealias in callable reference receiver generation

^KT-56750 Fixed
This commit is contained in:
Kirill Rakhman
2023-03-01 10:54:04 +01:00
committed by Space Team
parent 3ec032212c
commit d00513599b
14 changed files with 80 additions and 2 deletions
@@ -698,10 +698,11 @@ class CallAndReferenceGenerator(
): IrExpression? {
val classSymbol = (qualifier.typeRef.coneType as? ConeClassLikeType)?.lookupTag?.toSymbol(session)
if (callableReferenceAccess != null && classSymbol is FirRegularClassSymbol) {
val classIdMatched = classSymbol.classId == qualifier.classId
val classId = qualifier.symbol?.fullyExpandedClass(session)?.classId
val classIdMatched = classSymbol.classId == classId
if (!classIdMatched) {
// Check whether we need get companion object as dispatch receiver
if (!classSymbol.fir.isCompanion || classSymbol.classId.outerClassId != qualifier.classId) {
if (!classSymbol.fir.isCompanion || classSymbol.classId.outerClassId != classId) {
return null
}
val resolvedReference = callableReferenceAccess.calleeReference as FirResolvedNamedReference
@@ -3794,6 +3794,12 @@ public class FirLightTreeBlackBoxCodegenTestGenerated extends AbstractFirLightTr
runTest("compiler/testData/codegen/box/callableReference/bound/syntheticExtensionOnLHS.kt");
}
@Test
@TestMetadata("typeAliasObjectBoundReference.kt")
public void testTypeAliasObjectBoundReference() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/bound/typeAliasObjectBoundReference.kt");
}
@Nested
@TestMetadata("compiler/testData/codegen/box/callableReference/bound/equals")
@TestDataPath("$PROJECT_ROOT")
@@ -3794,6 +3794,12 @@ public class FirPsiBlackBoxCodegenTestGenerated extends AbstractFirPsiBlackBoxCo
runTest("compiler/testData/codegen/box/callableReference/bound/syntheticExtensionOnLHS.kt");
}
@Test
@TestMetadata("typeAliasObjectBoundReference.kt")
public void testTypeAliasObjectBoundReference() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/bound/typeAliasObjectBoundReference.kt");
}
@Nested
@TestMetadata("compiler/testData/codegen/box/callableReference/bound/equals")
@TestDataPath("$PROJECT_ROOT")