IR: remove dependency of IrTypeSubstitutor on IrBuiltIns

It was only used in one place incorrectly anyway.
This commit is contained in:
Alexander Udalov
2023-09-11 17:54:39 +02:00
committed by Space Team
parent c2dfe415f3
commit 41f736a665
6 changed files with 41 additions and 56 deletions
@@ -23,8 +23,8 @@ import org.jetbrains.kotlin.ir.expressions.impl.*
import org.jetbrains.kotlin.ir.symbols.*
import org.jetbrains.kotlin.ir.types.*
import org.jetbrains.kotlin.ir.types.impl.*
import org.jetbrains.kotlin.utils.memoryOptimizedMap
import org.jetbrains.kotlin.ir.util.parentAsClass
import org.jetbrains.kotlin.utils.memoryOptimizedMap
import org.jetbrains.kotlin.backend.common.serialization.proto.IrBlock as ProtoBlock
import org.jetbrains.kotlin.backend.common.serialization.proto.IrBlockBody as ProtoBlockBody
import org.jetbrains.kotlin.backend.common.serialization.proto.IrBranch as ProtoBranch
@@ -193,8 +193,7 @@ class IrBodyDeserializer(
// TODO: probably a bit more abstraction possible here up to `IrMemberAccessExpression`
// but at this point further complexization looks overengineered
private class IrAnnotationType(private val builtIns: IrBuiltIns) : IrDelegatedSimpleType() {
private class IrAnnotationType : IrDelegatedSimpleType() {
var irConstructorCall: IrConstructorCall? = null
override val delegate: IrSimpleType by lazy { resolveType() }
@@ -228,13 +227,13 @@ class IrBodyDeserializer(
typeParameterSymbols.add(typeParameter.symbol)
}
val substitutor = IrTypeSubstitutor(typeParameterSymbols, typeArguments, builtIns)
val substitutor = IrTypeSubstitutor(typeParameterSymbols, typeArguments)
return substitutor.substitute(rawType) as IrSimpleType
}
}
fun deserializeAnnotation(proto: ProtoConstructorCall): IrConstructorCall {
val irType = IrAnnotationType(builtIns)
val irType = IrAnnotationType()
// TODO: use real coordinates
return deserializeConstructorCall(proto, 0, 0, irType).also { irType.irConstructorCall = it }
}