[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.LazyThreadSafetyMode.PUBLICATION
|
||||||
import kotlin.reflect.KProperty
|
import kotlin.reflect.KProperty
|
||||||
import org.jetbrains.kotlin.backend.common.ir.copyTo
|
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.objcexport.ObjCExport
|
||||||
import org.jetbrains.kotlin.backend.konan.llvm.coverage.CoverageManager
|
import org.jetbrains.kotlin.backend.konan.llvm.coverage.CoverageManager
|
||||||
import org.jetbrains.kotlin.ir.descriptors.WrappedSimpleFunctionDescriptor
|
import org.jetbrains.kotlin.ir.descriptors.WrappedSimpleFunctionDescriptor
|
||||||
@@ -145,7 +146,8 @@ internal class SpecialDeclarationsFactory(val context: Context) {
|
|||||||
isFakeOverride = false,
|
isFakeOverride = false,
|
||||||
isOperator = false
|
isOperator = false
|
||||||
).apply {
|
).apply {
|
||||||
descriptor.bind(this)
|
val bridge = this
|
||||||
|
descriptor.bind(bridge)
|
||||||
parent = function.parent
|
parent = function.parent
|
||||||
|
|
||||||
val dispatchReceiver = when (bridgeDirections.array[1]) {
|
val dispatchReceiver = when (bridgeDirections.array[1]) {
|
||||||
@@ -168,25 +170,12 @@ internal class SpecialDeclarationsFactory(val context: Context) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dispatchReceiverParameter = dispatchReceiver?.copyTo(this)
|
dispatchReceiverParameter = dispatchReceiver?.copyTo(bridge)
|
||||||
extensionReceiverParameter = extensionReceiver?.copyTo(this)
|
extensionReceiverParameter = extensionReceiver?.copyTo(bridge)
|
||||||
valueParameters += function.valueParameters.map { it.copyTo(this, type = valueParameterTypes[it.index]) }
|
valueParameters += function.valueParameters.map { it.copyTo(bridge, type = valueParameterTypes[it.index]) }
|
||||||
|
|
||||||
typeParameters += function.typeParameters.mapIndexed { index, parameter ->
|
typeParameters += function.typeParameters.map { parameter ->
|
||||||
WrappedTypeParameterDescriptor().let {
|
parameter.copyToWithoutSuperTypes(bridge).also { it.superTypes += parameter.superTypes }
|
||||||
IrTypeParameterImpl(
|
|
||||||
startOffset, endOffset,
|
|
||||||
origin,
|
|
||||||
IrTypeParameterSymbolImpl(it),
|
|
||||||
parameter.name,
|
|
||||||
index,
|
|
||||||
parameter.isReified,
|
|
||||||
parameter.variance
|
|
||||||
).apply {
|
|
||||||
it.bind(this)
|
|
||||||
superTypes += parameter.superTypes
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user