KT-2334 partly fix: boolean to object coercion
This commit is contained in:
@@ -447,7 +447,7 @@ public abstract class StackValue {
|
|||||||
putTuple0Instance(v);
|
putTuple0Instance(v);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (type != Type.BOOLEAN_TYPE && type.equals(JetTypeMapper.TYPE_OBJECT) && type.equals(JetTypeMapper.JL_BOOLEAN_TYPE)) {
|
if (type != Type.BOOLEAN_TYPE && !type.equals(JetTypeMapper.TYPE_OBJECT) && !type.equals(JetTypeMapper.JL_BOOLEAN_TYPE)) {
|
||||||
throw new UnsupportedOperationException("don't know how to put a compare as a non-boolean type " + type);
|
throw new UnsupportedOperationException("don't know how to put a compare as a non-boolean type " + type);
|
||||||
}
|
}
|
||||||
putAsBoolean(v);
|
putAsBoolean(v);
|
||||||
@@ -534,10 +534,12 @@ public abstract class StackValue {
|
|||||||
myOperand.put(type, v); // the operand will remove itself from the stack if needed
|
myOperand.put(type, v); // the operand will remove itself from the stack if needed
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (type != Type.BOOLEAN_TYPE) {
|
if (type != Type.BOOLEAN_TYPE && !type.equals(JetTypeMapper.TYPE_OBJECT) && !type.equals(JetTypeMapper.JL_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");
|
||||||
}
|
}
|
||||||
putAsBoolean(v);
|
putAsBoolean(v);
|
||||||
|
if(type != Type.BOOLEAN_TYPE)
|
||||||
|
box(Type.BOOLEAN_TYPE,type,v);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
import kotlin.test.*
|
||||||
|
import org.junit.Test as test
|
||||||
|
|
||||||
|
public class Test {
|
||||||
|
test fun f(): Unit {
|
||||||
|
assertEquals(true, !false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box() : String {
|
||||||
|
Test().f()
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
@@ -337,6 +337,10 @@ public class StdlibTest extends CodegenTestCase {
|
|||||||
blackBoxFile("regressions/kt1800.kt");
|
blackBoxFile("regressions/kt1800.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testKt2334() {
|
||||||
|
blackBoxFile("regressions/kt2334.kt");
|
||||||
|
}
|
||||||
|
|
||||||
public void testUptoDownto() {
|
public void testUptoDownto() {
|
||||||
blackBoxFile("uptoDownto.kt");
|
blackBoxFile("uptoDownto.kt");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user