Fixed bug with CHECK_NOT_NULL handling

This commit is contained in:
Igor Chevdar
2019-08-16 17:03:32 +03:00
parent 6ace855294
commit 3dd2e40fec
2 changed files with 2 additions and 2 deletions
@@ -184,7 +184,7 @@ internal class BuiltinOperatorLowering(val context: Context) : FileLoweringPass,
} }
} }
private fun lowerCheckNotNull(expression: IrCall) = builder.at(expression).irBlock { private fun lowerCheckNotNull(expression: IrCall) = builder.at(expression).irBlock(resultType = expression.type) {
val temp = irTemporary(expression.getValueArgument(0)!!) val temp = irTemporary(expression.getValueArgument(0)!!)
+irIfThen(context.irBuiltIns.unitType, irEqeqNull(irGet(temp)), irCall(symbols.ThrowNullPointerException)) +irIfThen(context.irBuiltIns.unitType, irEqeqNull(irGet(temp)), irCall(symbols.ThrowNullPointerException))
+irGet(temp) +irGet(temp)
@@ -152,7 +152,7 @@ fun IrBuilderWithScope.irForceNotNull(expression: IrExpression): IrExpression {
return expression return expression
} }
return irCall(context.irBuiltIns.checkNotNullSymbol).apply { return irCall(context.irBuiltIns.checkNotNullSymbol, expression.type.makeNotNull()).apply {
putValueArgument(0, expression) putValueArgument(0, expression)
} }
} }