[IR] Fixes related to IR validation

This commit is contained in:
Igor Chevdar
2019-06-21 17:23:26 +03:00
parent 175dfb41b6
commit 595a549188
5 changed files with 7 additions and 7 deletions
@@ -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
@@ -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
}