[K/N] Get rid of ArrayAsList class, use .asList() instead

^KT-57137
This commit is contained in:
Pavel Kunyavskiy
2023-03-06 12:32:37 +01:00
committed by Space Team
parent 967ddb8bb0
commit 8f4c6eae2f
4 changed files with 6 additions and 28 deletions
@@ -406,9 +406,6 @@ internal abstract class KonanSymbols(
val kTypeImplForTypeParametersWithRecursiveBounds = internalClass("KTypeImplForTypeParametersWithRecursiveBounds")
val kTypeProjectionList = internalClass("KTypeProjectionList")
val arrayAsList = internalClass("ArrayAsList")
val threadLocal = topLevelClass(KonanFqNames.threadLocal)
val sharedImmutable = topLevelClass(KonanFqNames.sharedImmutable)
@@ -108,7 +108,7 @@ internal class KTypeGenerator(
val result = irConstantObject(symbols.kTypeParameterImpl.owner, mapOf(
"name" to irConstantString(typeParameter.name.asString()),
"containerFqName" to irConstantString(typeParameter.parentUniqueName),
"upperBounds" to irKTypeList(typeParameter.superTypes, leaveReifiedForLater, seenTypeParameters),
"upperBoundsArray" to irKTypeArray(typeParameter.superTypes, leaveReifiedForLater, seenTypeParameters),
"varianceId" to irConstantInt(mapVariance(typeParameter.variance)),
"isReified" to irConstantBoolean(typeParameter.isReified),
))
@@ -122,18 +122,15 @@ internal class KTypeGenerator(
else -> parent.fqNameForIrSerialization.asString()
}
private fun IrBuilderWithScope.irKTypeList(
private fun IrBuilderWithScope.irKTypeArray(
types: List<IrType>,
leaveReifiedForLater: Boolean,
seenTypeParameters: MutableSet<IrTypeParameter>
): IrConstantValue {
val itemType = symbols.kType.defaultType
val elements = irConstantArray(symbols.array.typeWith(itemType),
return irConstantArray(symbols.array.typeWith(itemType),
types.map { irKType(it, leaveReifiedForLater, seenTypeParameters) }
)
return irConstantObject(symbols.arrayAsList.owner, mapOf(
"array" to elements
))
}
// this constants are copypasted from KVarianceMapper.Companion in KTypeImpl.kt