[IR] Used common type parameters copy function
This fixes possible [IR_VALIDATION] warnings because previously noone set parents for copied type parameters
This commit is contained in:
+8
-19
@@ -44,6 +44,7 @@ import java.lang.System.out
|
||||
import kotlin.LazyThreadSafetyMode.PUBLICATION
|
||||
import kotlin.reflect.KProperty
|
||||
import org.jetbrains.kotlin.backend.common.ir.copyTo
|
||||
import org.jetbrains.kotlin.backend.common.ir.copyToWithoutSuperTypes
|
||||
import org.jetbrains.kotlin.backend.konan.objcexport.ObjCExport
|
||||
import org.jetbrains.kotlin.backend.konan.llvm.coverage.CoverageManager
|
||||
import org.jetbrains.kotlin.ir.descriptors.WrappedSimpleFunctionDescriptor
|
||||
@@ -145,7 +146,8 @@ internal class SpecialDeclarationsFactory(val context: Context) {
|
||||
isFakeOverride = false,
|
||||
isOperator = false
|
||||
).apply {
|
||||
descriptor.bind(this)
|
||||
val bridge = this
|
||||
descriptor.bind(bridge)
|
||||
parent = function.parent
|
||||
|
||||
val dispatchReceiver = when (bridgeDirections.array[1]) {
|
||||
@@ -168,25 +170,12 @@ internal class SpecialDeclarationsFactory(val context: Context) {
|
||||
}
|
||||
}
|
||||
|
||||
dispatchReceiverParameter = dispatchReceiver?.copyTo(this)
|
||||
extensionReceiverParameter = extensionReceiver?.copyTo(this)
|
||||
valueParameters += function.valueParameters.map { it.copyTo(this, type = valueParameterTypes[it.index]) }
|
||||
dispatchReceiverParameter = dispatchReceiver?.copyTo(bridge)
|
||||
extensionReceiverParameter = extensionReceiver?.copyTo(bridge)
|
||||
valueParameters += function.valueParameters.map { it.copyTo(bridge, type = valueParameterTypes[it.index]) }
|
||||
|
||||
typeParameters += function.typeParameters.mapIndexed { index, parameter ->
|
||||
WrappedTypeParameterDescriptor().let {
|
||||
IrTypeParameterImpl(
|
||||
startOffset, endOffset,
|
||||
origin,
|
||||
IrTypeParameterSymbolImpl(it),
|
||||
parameter.name,
|
||||
index,
|
||||
parameter.isReified,
|
||||
parameter.variance
|
||||
).apply {
|
||||
it.bind(this)
|
||||
superTypes += parameter.superTypes
|
||||
}
|
||||
}
|
||||
typeParameters += function.typeParameters.map { parameter ->
|
||||
parameter.copyToWithoutSuperTypes(bridge).also { it.superTypes += parameter.superTypes }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user