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 d2ab16c0f25..9b668d03563 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 @@ -215,9 +215,16 @@ class IrInterpreter(irModule: IrModuleFragment) { val receiverType = descriptor.dispatchReceiverParameter?.type ?: descriptor.extensionReceiverParameter?.type val argsType = listOfNotNull(receiverType) + descriptor.valueParameters.map { it.original.type } - val argsValues = args.map { (it as? Complex)?.getOriginal() ?: (it as Primitive<*>).value } + val argsValues = args.map { + when (it) { + is Complex -> it.getOriginal() + is Primitive<*> -> it.value + else -> it // lambda can be used in built in calculation, for example, in null check + } + } val signature = CompileTimeFunction(methodName, argsType.map { it.toString() }) + // TODO replace unary, binary, ternary functions with vararg val result = when (argsType.size) { 1 -> { val function = unaryFunctions[signature]