fix tests
This commit is contained in:
@@ -116,7 +116,8 @@ public class ClosureCodegen {
|
|||||||
final List<ValueParameterDescriptor> params = funDescriptor.getUnsubstitutedValueParameters();
|
final List<ValueParameterDescriptor> params = funDescriptor.getUnsubstitutedValueParameters();
|
||||||
int count = 1;
|
int count = 1;
|
||||||
for (ValueParameterDescriptor param : params) {
|
for (ValueParameterDescriptor param : params) {
|
||||||
StackValue.local(count, JetTypeMapper.TYPE_OBJECT).put(typeMapper.mapType(param.getOutType()), iv);
|
StackValue.local(count, JetTypeMapper.TYPE_OBJECT).put(JetTypeMapper.TYPE_OBJECT, iv);
|
||||||
|
StackValue.onStack(JetTypeMapper.TYPE_OBJECT).upcast(typeMapper.mapType(param.getOutType()), iv);
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -795,7 +795,7 @@ public class ExpressionCodegen extends JetVisitor {
|
|||||||
|
|
||||||
if (methodDescriptor.getReturnType() != Type.VOID_TYPE) {
|
if (methodDescriptor.getReturnType() != Type.VOID_TYPE) {
|
||||||
final Type retType = typeMapper.mapType(fd.getUnsubstitutedReturnType());
|
final Type retType = typeMapper.mapType(fd.getUnsubstitutedReturnType());
|
||||||
StackValue.onStack(methodDescriptor.getReturnType()).put(retType, v);
|
StackValue.onStack(methodDescriptor.getReturnType()).upcast(retType, v);
|
||||||
myStack.push(StackValue.onStack(retType));
|
myStack.push(StackValue.onStack(retType));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -130,12 +130,23 @@ public abstract class StackValue {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void coerce(Type type, InstructionAdapter v) {
|
public void upcast(Type type, InstructionAdapter v) {
|
||||||
if (type.equals(this.type)) return;
|
if (type.equals(this.type)) return;
|
||||||
|
|
||||||
if (type.getSort() == Type.OBJECT && this.type.getSort() == Type.OBJECT) {
|
if (type.getSort() == Type.OBJECT && this.type.getSort() == Type.OBJECT) {
|
||||||
v.checkcast(type);
|
v.checkcast(type);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
coerce(type, v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void coerce(Type type, InstructionAdapter v) {
|
||||||
|
if (type.equals(this.type)) return;
|
||||||
|
|
||||||
|
if (type.getSort() == Type.OBJECT && this.type.getSort() == Type.OBJECT) {
|
||||||
|
// v.checkcast(type);
|
||||||
|
}
|
||||||
else if (type.getSort() == Type.OBJECT) {
|
else if (type.getSort() == Type.OBJECT) {
|
||||||
box(this.type, type, v);
|
box(this.type, type, v);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user