FIR: Fix candidate receivers orders when choosing a context receiver

^KT-53257 Fixed
This commit is contained in:
Denis.Zharkov
2022-07-22 13:31:08 +02:00
committed by Space
parent 8299cec66b
commit 7f7e5c5975
8 changed files with 57 additions and 18 deletions
@@ -17182,6 +17182,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
runTest("compiler/testData/codegen/box/extensionFunctions/contextReceivers/propertyCompoundAssignment.kt");
}
@Test
@TestMetadata("receiversOrder.kt")
public void testReceiversOrder() throws Exception {
runTest("compiler/testData/codegen/box/extensionFunctions/contextReceivers/receiversOrder.kt");
}
@Test
@TestMetadata("simpleCall.kt")
public void testSimpleCall() throws Exception {
@@ -200,7 +200,7 @@ object CheckContextReceivers : ResolutionStage() {
}?.takeUnless { it.isEmpty() } ?: return
val receiverGroups: List<List<ImplicitReceiverValue<*>>> =
context.bodyResolveContext.towerDataContext.towerDataElements.mapNotNull { towerDataElement ->
context.bodyResolveContext.towerDataContext.towerDataElements.asReversed().mapNotNull { towerDataElement ->
towerDataElement.implicitReceiver?.let(::listOf) ?: towerDataElement.contextReceiverGroup
}