KT-1538 proper boolean invertion
This commit is contained in:
@@ -468,8 +468,10 @@ public abstract class StackValue {
|
|||||||
private StackValue myOperand;
|
private StackValue myOperand;
|
||||||
|
|
||||||
private Invert(StackValue operand) {
|
private Invert(StackValue operand) {
|
||||||
super(operand.type);
|
super(Type.BOOLEAN_TYPE);
|
||||||
myOperand = operand;
|
myOperand = operand;
|
||||||
|
if(myOperand.type != Type.BOOLEAN_TYPE)
|
||||||
|
throw new UnsupportedOperationException("operand of ! must be boolean");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ public class Not implements IntrinsicMethod {
|
|||||||
else {
|
else {
|
||||||
stackValue = receiver;
|
stackValue = receiver;
|
||||||
}
|
}
|
||||||
return StackValue.not(stackValue);
|
stackValue.put(Type.BOOLEAN_TYPE, v);
|
||||||
|
return StackValue.not(StackValue.onStack(Type.BOOLEAN_TYPE));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
import java.util.HashMap
|
||||||
|
|
||||||
|
fun parseCatalogs(hashMap: Any?) {
|
||||||
|
val r = toHasMap(hashMap)
|
||||||
|
if (!r._1) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
val nodes = r._2
|
||||||
|
}
|
||||||
|
|
||||||
|
fun toHasMap(value: Any?): #(Boolean, HashMap<String, Any?>?) {
|
||||||
|
if(value is HashMap<*, *>) {
|
||||||
|
return #(true, value as HashMap<String, Any?>)
|
||||||
|
}
|
||||||
|
return #(false, null as HashMap<String, Any?>?)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box() : String {
|
||||||
|
parseCatalogs(null)
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
@@ -307,4 +307,9 @@ public class ClassGenTest extends CodegenTestCase {
|
|||||||
public void testKt1345() throws Exception {
|
public void testKt1345() throws Exception {
|
||||||
blackBoxFile("regressions/kt1345.kt");
|
blackBoxFile("regressions/kt1345.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testKt1538() throws Exception {
|
||||||
|
blackBoxFile("regressions/kt1538.kt");
|
||||||
|
System.out.println(generateToText());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user