Eval4j: fix coerce for arrays in return

#KT-5554 Fixed
This commit is contained in:
Natalia Ukhorskaya
2014-09-11 13:09:13 +04:00
parent 4667190b8c
commit e0469de5be
@@ -175,7 +175,7 @@ public fun interpreterLoop(
IRETURN, LRETURN, FRETURN, DRETURN, ARETURN -> {
val value = frame.getStackTop()
val expectedType = Type.getReturnType(m.desc)
if (expectedType.getSort() == Type.OBJECT) {
if (expectedType.getSort() == Type.OBJECT || expectedType.getSort() == Type.ARRAY) {
val coerced = if (value != NULL_VALUE && value.asmType != expectedType)
ObjectValue(value.obj(), expectedType)
else value