Scripts: coerce result to the actual expression type
#KT-5622 Fixed
This commit is contained in:
@@ -193,7 +193,7 @@ public class ScriptCodegen extends MemberCodegen<JetScript> {
|
||||
StackValue stackValue =
|
||||
new ExpressionCodegen(mv, frameMap, Type.VOID_TYPE, methodContext, state, this).gen(scriptDeclaration.getBlockExpression());
|
||||
if (stackValue.type != Type.VOID_TYPE) {
|
||||
stackValue.put(stackValue.type, iv);
|
||||
stackValue.put(blockType, iv);
|
||||
iv.putfield(classType.getInternalName(), ScriptDescriptor.LAST_EXPRESSION_VALUE_FIELD_NAME, blockType.getDescriptor());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user