[IR] Fixes related to IR validation
This commit is contained in:
+1
-1
@@ -82,7 +82,7 @@ class LateinitLowering(val context: CommonBackendContext) : FileLoweringPass {
|
||||
).also {
|
||||
descriptor.bind(it)
|
||||
it.parent = declaration.parent
|
||||
it.initializer = IrConstImpl.constNull(declaration.startOffset, declaration.endOffset, type)
|
||||
it.initializer = IrConstImpl.constNull(declaration.startOffset, declaration.endOffset, context.irBuiltIns.nothingNType)
|
||||
}
|
||||
|
||||
nullableVariables[declaration] = newVar
|
||||
|
||||
+1
-1
@@ -60,7 +60,7 @@ private class JvmOverloadsAnnotationLowering(val context: JvmBackendContext) : C
|
||||
val wrapperIrFunction = generateWrapperHeader(target, numDefaultParametersToExpect)
|
||||
|
||||
val call = if (target is IrConstructor)
|
||||
IrDelegatingConstructorCallImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, target.returnType, target.symbol, target.descriptor)
|
||||
IrDelegatingConstructorCallImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, context.irBuiltIns.unitType, target.symbol, target.descriptor)
|
||||
else
|
||||
IrCallImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, target.returnType, target.symbol)
|
||||
call.dispatchReceiver = wrapperIrFunction.dispatchReceiverParameter?.let { dispatchReceiver ->
|
||||
|
||||
@@ -161,9 +161,8 @@ class CallGenerator(statementGenerator: StatementGenerator) : StatementGenerator
|
||||
if (dispatchReceiver != null) throw AssertionError("Dispatch receiver should be null: $dispatchReceiver")
|
||||
if (extensionReceiver != null) throw AssertionError("Extension receiver should be null: $extensionReceiver")
|
||||
val constructorSymbol = context.symbolTable.referenceConstructor(constructorDescriptor.original)
|
||||
val irResultType = constructorDescriptor.returnType.toIrType()
|
||||
val irCall = IrEnumConstructorCallImpl(startOffset, endOffset, irResultType, constructorSymbol)
|
||||
addParametersToCall(startOffset, endOffset, call, irCall, irResultType)
|
||||
val irCall = IrEnumConstructorCallImpl(startOffset, endOffset, context.irBuiltIns.unitType, constructorSymbol)
|
||||
addParametersToCall(startOffset, endOffset, call, irCall, context.irBuiltIns.unitType)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -294,7 +294,7 @@ fun IrBuilderWithScope.irCall(callee: IrFunction, origin: IrStatementOrigin): Ir
|
||||
|
||||
fun IrBuilderWithScope.irDelegatingConstructorCall(callee: IrConstructor): IrDelegatingConstructorCall =
|
||||
IrDelegatingConstructorCallImpl(
|
||||
startOffset, endOffset, callee.returnType, callee.symbol, callee.descriptor,
|
||||
startOffset, endOffset, context.irBuiltIns.unitType, callee.symbol, callee.descriptor,
|
||||
callee.parentAsClass.typeParameters.size, callee.valueParameters.size
|
||||
)
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ import org.jetbrains.kotlin.ir.types.IrType
|
||||
import org.jetbrains.kotlin.ir.types.IrTypeProjection
|
||||
import org.jetbrains.kotlin.ir.types.impl.IrSimpleTypeImpl
|
||||
import org.jetbrains.kotlin.ir.types.impl.IrTypeProjectionImpl
|
||||
import org.jetbrains.kotlin.ir.types.impl.makeTypeProjection
|
||||
|
||||
class DeepCopyTypeRemapper(
|
||||
private val symbolRemapper: SymbolRemapper
|
||||
@@ -33,7 +34,7 @@ class DeepCopyTypeRemapper(
|
||||
|
||||
val arguments = type.arguments.map {
|
||||
if (it is IrTypeProjection) {
|
||||
IrTypeProjectionImpl(this.remapType(it.type), it.variance)
|
||||
makeTypeProjection(this.remapType(it.type), it.variance)
|
||||
} else {
|
||||
it
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user