diff --git a/compiler/ir/ir.interpreter/src/org/jetbrains/kotlin/ir/interpreter/IrInterpreter.kt b/compiler/ir/ir.interpreter/src/org/jetbrains/kotlin/ir/interpreter/IrInterpreter.kt index 8fbab5fa0e9..4550f1a6d2c 100644 --- a/compiler/ir/ir.interpreter/src/org/jetbrains/kotlin/ir/interpreter/IrInterpreter.kt +++ b/compiler/ir/ir.interpreter/src/org/jetbrains/kotlin/ir/interpreter/IrInterpreter.kt @@ -569,9 +569,12 @@ class IrInterpreter(private val irBuiltIns: IrBuiltIns, private val bodyMap: Map } private fun interpretGetValue(expression: IrGetValue): ExecutionResult { - val owner = expression.type.classOrNull?.owner + val expectedClass = expression.type.classOrNull?.owner // used to evaluate constants inside object - if (owner != null && owner.isObject) return getOrCreateObjectValue(owner) // TODO is this correct behaviour? + if (expectedClass != null && expectedClass.isObject && expression.symbol.owner.origin == IrDeclarationOrigin.INSTANCE_RECEIVER) { + // TODO is this correct behaviour? + return getOrCreateObjectValue(expectedClass) + } stack.pushReturnValue(stack.getVariable(expression.symbol).state) return Next }