KT-1054 comparison of booleans

This commit is contained in:
Alex Tkachman
2012-01-18 18:10:41 +01:00
parent 01b405c86a
commit a529ad2ac7
3 changed files with 22 additions and 1 deletions
@@ -1690,7 +1690,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> {
}
public StackValue generateEqualsForExpressionsOnStack(IElementType opToken, Type leftType, Type rightType, boolean leftNullable, boolean rightNullable) {
if (isNumberPrimitive(leftType) && leftType == rightType) {
if ((isNumberPrimitive(leftType) || leftType.getSort() == Type.BOOLEAN) && leftType == rightType) {
return compareExpressionsOnStack(opToken, leftType);
}
else {
@@ -0,0 +1,17 @@
fun box() : String {
return if(true.and(true)) "OK" else "fail"
}
fun Boolean.and(other : Boolean) : Boolean{
if(other == true) {
if(this == true){
return true ;
}
else{
return false;
}
}
else {
return false;
}
}
@@ -395,4 +395,8 @@ public class PrimitiveTypesTest extends CodegenTestCase {
public void testKt1055 () {
blackBoxFile("regressions/kt1055.kt");
}
public void testKt1054 () {
blackBoxFile("regressions/kt1054.kt");
}
}