[K/N] Handle Unit? and Nothing? correctly in finally transformation

^KT-52985
This commit is contained in:
Pavel Kunyavskiy
2022-06-28 15:25:34 +02:00
committed by Space
parent dc48d722fe
commit c1ec1d9d4c
10 changed files with 80 additions and 3 deletions
@@ -267,9 +267,8 @@ class FinallyBlocksLowering(val context: CommonBackendContext, private val throw
value: IrExpression,
finallyExpression: IrExpression
): IrExpression {
val returnTypeClassifier = (type as? IrSimpleType)?.classifier
return when (returnTypeClassifier) {
context.irBuiltIns.unitClass, context.irBuiltIns.nothingClass -> irBlock(value, null, type) {
return when {
type.isUnit() || type.isNothing() -> irBlock(value, null, type) {
+irReturnableBlock(symbol, type) {
+value
}