KT-1054 comparison of booleans
This commit is contained in:
@@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user