From 635166c9694b543b6d01d27924499693249a1efd Mon Sep 17 00:00:00 2001 From: Ivan Kochurkin Date: Fri, 28 Jan 2022 22:56:38 +0300 Subject: [PATCH] [FIR] Get rid of excess allocations in FlatSignature --- .../kotlin/resolve/calls/results/FlatSignature.kt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/compiler/resolution.common/src/org/jetbrains/kotlin/resolve/calls/results/FlatSignature.kt b/compiler/resolution.common/src/org/jetbrains/kotlin/resolve/calls/results/FlatSignature.kt index 2bafccf916a..e8b15a05fef 100644 --- a/compiler/resolution.common/src/org/jetbrains/kotlin/resolve/calls/results/FlatSignature.kt +++ b/compiler/resolution.common/src/org/jetbrains/kotlin/resolve/calls/results/FlatSignature.kt @@ -72,14 +72,15 @@ private fun SimpleConstraintSystem.isValueParameterTypeNotLessSpecific( var specificValueParameterTypes = specific.valueParameterTypes var generalValueParameterTypes = general.valueParameterTypes + if (specificContextReceiverCount != generalContextReceiverCount) { specificValueParameterTypes = specificValueParameterTypes.drop(specificContextReceiverCount) generalValueParameterTypes = generalValueParameterTypes.drop(generalContextReceiverCount) } - val valueParameters = specificValueParameterTypes.map(typeKindSelector).zip(generalValueParameterTypes.map(typeKindSelector)) - for ((specificType, generalType) in valueParameters) { - if (specificType == null || generalType == null) continue + for (index in specificValueParameterTypes.indices) { + val specificType = typeKindSelector(specificValueParameterTypes[index]) ?: continue + val generalType = typeKindSelector(generalValueParameterTypes[index]) ?: continue if (specificityComparator.isDefinitelyLessSpecific(specificType, generalType)) { return false