[FIR] Never create ConeSubstitutorByMap with empty substitution

Relates to KT-66323
This commit is contained in:
Dmitriy Novozhilov
2024-03-04 08:51:37 +02:00
committed by Space Team
parent 6c691b497a
commit 624bea3ecf
16 changed files with 57 additions and 27 deletions
@@ -80,7 +80,7 @@ object FirQualifiedAccessJavaNullabilityWarningChecker : FirQualifiedAccessExpre
}
}
return ConeSubstitutorByMap(substitutionMap, session)
return ConeSubstitutorByMap.create(substitutionMap, session)
}
}
@@ -279,7 +279,7 @@ fun findStaticallyKnownSubtype(
// At this point we have values for all type parameters of List
// Let's make a type by substituting them: List<T> -> List<Foo>
val substitutor = ConeSubstitutorByMap(resultSubstitution, session)
val substitutor = ConeSubstitutorByMap.create(resultSubstitution, session)
return substitutor.substituteOrSelf(subtypeWithVariablesType)
}
@@ -69,7 +69,7 @@ private fun buildDeepSubstitutionMultimap(
for (index in 0 until count) {
val typeArgument = typeArguments[index]
val substitutedArgument = ConeSubstitutorByMap(substitution, session)
val substitutedArgument = ConeSubstitutorByMap.create(substitution, session)
.substituteArgument(typeArgument, index)
?: typeArgument
val substitutedType = substitutedArgument.type ?: continue