From e1bc6c54d78410d564ae629032230e2ae98ad1d0 Mon Sep 17 00:00:00 2001 From: "sebastian.sellmair" Date: Thu, 16 Sep 2021 14:55:21 +0200 Subject: [PATCH] [Commonizer] Simplify CirClassOrTypeAliasType.withParentArguments() ^KT-48288 --- .../org/jetbrains/kotlin/commonizer/cir/utils.kt | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/native/commonizer/src/org/jetbrains/kotlin/commonizer/cir/utils.kt b/native/commonizer/src/org/jetbrains/kotlin/commonizer/cir/utils.kt index 41c625af6c8..27ee55c7512 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/commonizer/cir/utils.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/commonizer/cir/utils.kt @@ -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)) {