From 015f257031461f843a4b8f1aa721f507d95c2772 Mon Sep 17 00:00:00 2001 From: Kirill Rakhman Date: Mon, 4 Mar 2024 16:55:32 +0100 Subject: [PATCH] [FIR2IR] Remove special handling of named arguments for vararg FirNamedArgumentExpressions don't exist anymore during FIR2IR phase and so handling FirSpreadArgumentExpression in Fir2IrVisitor is sufficient. #KT-66124 --- .../kotlin/fir/backend/Fir2IrVisitor.kt | 2 +- .../generators/CallAndReferenceGenerator.kt | 18 ------------------ 2 files changed, 1 insertion(+), 19 deletions(-) diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrVisitor.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrVisitor.kt index 6125d1c4f9c..99ec9e735bf 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrVisitor.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrVisitor.kt @@ -550,7 +550,7 @@ class Fir2IrVisitor( } private fun FirExpression.convertToIrVarargElement(): IrVarargElement = - if (this is FirSpreadArgumentExpression || this is FirNamedArgumentExpression && this.isSpread) { + if (this is FirSpreadArgumentExpression) { IrSpreadElementImpl( source?.startOffset ?: UNDEFINED_OFFSET, source?.endOffset ?: UNDEFINED_OFFSET, 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 311a2616fa3..1cadb4b310c 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 @@ -1072,27 +1072,9 @@ class CallAndReferenceGenerator( } } return irArgument - .applyAssigningArrayElementsToVarargInNamedForm(unwrappedArgument, parameter) .applyImplicitIntegerCoercionIfNeeded(unwrappedArgument, parameter) } - private fun IrExpression.applyAssigningArrayElementsToVarargInNamedForm( - argument: FirExpression, - parameter: FirValueParameter?, - ): IrExpression { - if (this is IrVararg && parameter?.isVararg == true && argument is FirVarargArgumentsExpression && elements.size == 1) { - val irVarargElement = elements[0] - if (argument.arguments[0] is FirNamedArgumentExpression && - // IrVarargElement can be either IrSpreadElement (then nothing to do) or IrExpression - irVarargElement is IrExpression && - (irVarargElement.type.isArray() || irVarargElement.type.isPrimitiveArray() || irVarargElement.type.isUnsignedArray()) - ) { - elements[0] = IrSpreadElementImpl(irVarargElement.startOffset, irVarargElement.endOffset, irVarargElement) - } - } - return this - } - private fun IrExpression.applyImplicitIntegerCoercionIfNeeded( argument: FirExpression, parameter: FirValueParameter?,