diff --git a/idea/src/org/jetbrains/jet/codegen/StackValue.java b/idea/src/org/jetbrains/jet/codegen/StackValue.java index 6dbbe94b8a9..fedaefa0760 100644 --- a/idea/src/org/jetbrains/jet/codegen/StackValue.java +++ b/idea/src/org/jetbrains/jet/codegen/StackValue.java @@ -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); } diff --git a/idea/tests/org/jetbrains/jet/codegen/NamespaceGenTest.java b/idea/tests/org/jetbrains/jet/codegen/NamespaceGenTest.java index dc2c1eb6c32..6b4d827967f 100644 --- a/idea/tests/org/jetbrains/jet/codegen/NamespaceGenTest.java +++ b/idea/tests/org/jetbrains/jet/codegen/NamespaceGenTest.java @@ -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 + } }