提交 b7e6de73 编写于 作者: D Dmitry Jemerov

putting a compare on stack as void type is a nop, not an error

上级 167e5bb4
......@@ -235,8 +235,11 @@ public abstract class StackValue {
@Override
public void put(Type type, InstructionAdapter v) {
if (type == Type.VOID_TYPE) {
return;
}
if (type != Type.BOOLEAN_TYPE) {
throw new UnsupportedOperationException("don't know how to put a compare as a non-boolean type");
throw new UnsupportedOperationException("don't know how to put a compare as a non-boolean type " + type);
}
putAsBoolean(v);
}
......
......@@ -408,4 +408,10 @@ public class NamespaceGenTest extends CodegenTestCase {
public void testCheckCast() throws Exception {
blackBoxFile("checkCast.jet");
}
public void testPutBooleanAsVoid() throws Exception {
loadText("class C(val x: Int) { { x > 0 } } fun box() { val c = C(0) } ");
final Method main = generateFunction();
main.invoke(null); // must not fail
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册