[Commonizer] Simplify CirClassOrTypeAliasType.withParentArguments()

^KT-48288
This commit is contained in:
sebastian.sellmair
2021-09-16 14:55:21 +02:00
committed by Space
parent 459e01a729
commit e1bc6c54d7
@@ -90,17 +90,9 @@ internal fun CirClassOrTypeAliasType.withParentArguments(
val newIsMarkedNullable = isMarkedNullable || parentIsMarkedNullable
val newArguments = arguments.map { oldArgument ->
if (oldArgument is CirRegularTypeProjection) {
val oldArgumentType = oldArgument.type
if (oldArgumentType is CirTypeParameterType) {
when (val parentArgument = parentArguments[oldArgumentType.index]) {
is CirRegularTypeProjection -> if (parentArgument is CirClassOrTypeAliasType) return@map parentArgument
is CirStarTypeProjection -> return@map parentArgument
}
return@map parentArguments[oldArgumentType.index]
}
}
oldArgument
if (oldArgument !is CirRegularTypeProjection) return@map oldArgument
if (oldArgument.type !is CirTypeParameterType) return@map oldArgument
parentArguments[oldArgument.type.index]
}
return when (val newUnderlyingType = makeNullableIfNecessary(newIsMarkedNullable).withArguments(newArguments)) {