Fix codegen for closures returning 'Unit?'
Only do a checkcast when we need to coerce Object to Unit: the code was hopefully type-checked so that it'll only be necessary when the value is either Unit.VALUE or null
This commit is contained in:
@@ -242,7 +242,10 @@ public abstract class StackValue {
|
||||
}
|
||||
}
|
||||
else if (toType.equals(JET_UNIT_TYPE)) {
|
||||
if (!fromType.equals(getType(Void.class))) {
|
||||
if (fromType.equals(getType(Object.class))) {
|
||||
v.checkcast(JET_UNIT_TYPE);
|
||||
}
|
||||
else if (!fromType.equals(getType(Void.class))) {
|
||||
pop(v, fromType);
|
||||
putUnitInstance(v);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user