From 766d87327127c29c704000e52f4606e264459fc7 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Tue, 19 Jul 2022 15:13:35 +0200 Subject: [PATCH] FIR2IR: fix case with extension called on dynamic --- .../fir/backend/generators/CallAndReferenceGenerator.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/CallAndReferenceGenerator.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/CallAndReferenceGenerator.kt index 7a32017abd4..6743a913195 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/CallAndReferenceGenerator.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/CallAndReferenceGenerator.kt @@ -422,7 +422,9 @@ class CallAndReferenceGenerator( // resolve into members of `Any`. val convertedExplicitReceiver = if (explicitReceiverExpression?.type is IrDynamicType) { qualifiedAccess.convertWithOffsets { startOffset, endOffset -> - val targetType = (firSymbol?.fir as? FirCallableDeclaration)?.dispatchReceiverType?.toIrType() + val callableDeclaration = firSymbol?.fir as? FirCallableDeclaration + val targetType = callableDeclaration?.dispatchReceiverType?.toIrType() + ?: callableDeclaration?.receiverTypeRef?.toIrType() ?: error("Couldn't get the proper receiver") IrTypeOperatorCallImpl( startOffset, endOffset, targetType,