[FIR] Get rid of excess allocations in FlatSignature

This commit is contained in:
Ivan Kochurkin
2022-01-28 22:56:38 +03:00
committed by teamcity
parent a0510f4a67
commit 635166c969
@@ -72,14 +72,15 @@ private fun <T> 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