[FIR] Build resolved argument list for augmented array assignment get call

This lets us get rid of some fallback code in FIR2IR that handles
unresolved argument lists.
After this, we should have an invariant that all non-empty argument
lists are resolved when FIR2IR runs.

#KT-66124
This commit is contained in:
Kirill Rakhman
2024-03-04 13:37:10 +01:00
committed by Space Team
parent 8443daf78d
commit 454ef4ae46
2 changed files with 20 additions and 32 deletions
@@ -1635,23 +1635,25 @@ open class FirExpressionsResolveTransformer(transformer: FirAbstractBodyResolveT
dispatchReceiver = lhsGetCall.dispatchReceiver
}
calleeReference = lhsGetCall.calleeReference
argumentList = buildArgumentList {
var i = 0
for (argument in lhsGetCall.argumentList.arguments) {
arguments += if (argument is FirVarargArgumentsExpression) {
buildVarargArgumentsExpression {
val varargSize = argument.arguments.size
arguments += indicesQualifiedAccessForGet.subList(i, i + varargSize)
i += varargSize
source = argument.source
coneTypeOrNull = argument.resolvedType
coneElementTypeOrNull = argument.coneElementTypeOrNull
}
} else {
indicesQualifiedAccessForGet[i++]
var i = 0
val newMapping = (lhsGetCall.argumentList as FirResolvedArgumentList).mapping.mapKeysTo(LinkedHashMap()) { (argument) ->
if (argument is FirVarargArgumentsExpression) {
buildVarargArgumentsExpression {
val varargSize = argument.arguments.size
arguments += indicesQualifiedAccessForGet.subList(i, i + varargSize)
i += varargSize
source = argument.source
coneTypeOrNull = argument.resolvedType
coneElementTypeOrNull = argument.coneElementTypeOrNull
}
} else {
indicesQualifiedAccessForGet[i++]
}
}
argumentList = buildResolvedArgumentList(
lhsGetCall.argumentList,
newMapping,
)
origin = FirFunctionCallOrigin.Operator
coneTypeOrNull = lhsGetCall.resolvedType
}