From 4da51ee99780b38eb8fb7f6cfd0723def610336d Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Thu, 22 Jun 2023 14:26:44 +0300 Subject: [PATCH] [FIR2IR] Use FIR symbol instead of IR during conversion of function calls --- .../backend/generators/CallAndReferenceGenerator.kt | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) 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 2e79427cbcf..e09b199d060 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 @@ -399,10 +399,17 @@ class CallAndReferenceGenerator( when (symbol) { is IrConstructorSymbol -> IrConstructorCallImpl.fromSymbolOwner(startOffset, endOffset, type, symbol) is IrSimpleFunctionSymbol -> { + require(firSymbol is FirCallableSymbol<*>) { "Illegal symbol: ${firSymbol!!::class}" } + val valueParametersNumber = when (firSymbol) { + is FirSyntheticPropertySymbol -> 0 + is FirNamedFunctionSymbol -> firSymbol.valueParameterSymbols.size + firSymbol.resolvedContextReceivers.size + is FirFunctionSymbol<*> -> firSymbol.valueParameterSymbols.size + else -> error("Illegal symbol: ${firSymbol::class}") + } IrCallImpl( startOffset, endOffset, type, symbol, - typeArgumentsCount = symbol.owner.typeParameters.size, - valueArgumentsCount = symbol.owner.valueParameters.size, + typeArgumentsCount = firSymbol.typeParameterSymbols.size, + valueArgumentsCount = valueParametersNumber, origin = calleeReference.statementOrigin(), superQualifierSymbol = dispatchReceiver.superQualifierSymbol() )