IR: bugfix in KotlinNothingValueExceptionLowering

This commit is contained in:
Georgy Bronnikov
2020-04-21 16:25:47 +03:00
parent 1fb325d56e
commit 3bb32941a0
8 changed files with 38 additions and 2 deletions
@@ -43,12 +43,12 @@ class KotlinNothingValueExceptionLowering(val backendContext: CommonBackendConte
// (although doing so by subverting the type system).
backendContext.createIrBuilder(parent, expression.startOffset, expression.endOffset).run {
irBlock(expression, null, context.irBuiltIns.nothingType) {
+changeTypeToUnit(expression)
+super.visitCall(changeTypeToUnit(expression))
+irCall(backendContext.ir.symbols.ThrowKotlinNothingValueException)
}
}
} else {
expression
super.visitCall(expression)
}
private fun changeTypeToUnit(call: IrCall): IrCall =