diff --git a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/interpreter/IrInterpreter.kt b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/interpreter/IrInterpreter.kt index ef98b275ae9..fd3502a1b7b 100644 --- a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/interpreter/IrInterpreter.kt +++ b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/interpreter/IrInterpreter.kt @@ -82,7 +82,7 @@ class IrInterpreter(irModule: IrModuleFragment) { return when (code) { Code.RETURN -> when (this) { - is IrCall -> Code.NEXT + is IrCall, is IrReturnableBlock -> Code.NEXT else -> Code.RETURN } Code.BREAK_WHEN -> when (this) { @@ -419,7 +419,7 @@ class IrInterpreter(irModule: IrModuleFragment) { IrTypeOperator.IMPLICIT_COERCION_TO_UNIT -> { expression.argument.interpret(data) } - IrTypeOperator.CAST -> { + IrTypeOperator.CAST, IrTypeOperator.IMPLICIT_DYNAMIC_CAST -> { expression.argument.interpret(data) //todo check cast correctness } else -> TODO("${expression.operator} not implemented") diff --git a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/interpreter/Utils.kt b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/interpreter/Utils.kt index d8e4542c82c..08af8e5d6ba 100644 --- a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/interpreter/Utils.kt +++ b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/interpreter/Utils.kt @@ -82,10 +82,15 @@ fun IrFunction.isFakeOverridden(): Boolean { fun State.toIrExpression(expression: IrExpression): IrExpression { return when (this) { - is Primitive<*> -> this.value.toIrConst( // this is necessary to replace ir offsets - this.type, expression.startOffset, expression.endOffset - ) - else -> TODO("not supported") + is Primitive<*> -> + when (this.value) { + // toIrConst call is necessary to replace ir offsets + is Boolean, is Char, is Byte, is Short, is Int, is Long, is String, is Float, is Double -> + this.value.toIrConst(this.type, expression.startOffset, expression.endOffset) + null -> this.value.toIrConst(this.type, expression.startOffset, expression.endOffset) + else -> expression // TODO support for arrays + } + else -> expression // TODO support } }