From: Luca Bruno Date: Fri, 5 Dec 2014 18:00:51 +0000 (+0100) Subject: Support XOR operation for booleans X-Git-Tag: 0.27.1~26 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=43162699924ee9295b47e1fecf6068e6fe4b4ad8;p=thirdparty%2Fvala.git Support XOR operation for booleans Fixes bug 729907 --- diff --git a/tests/Makefile.am b/tests/Makefile.am index ee5bbfeab..8143bda83 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -37,6 +37,7 @@ TESTS = \ basic-types/bug659975.vala \ basic-types/bug678791.vala \ basic-types/bug686336.vala \ + basic-types/bug729907.vala \ namespaces.vala \ methods/lambda.vala \ methods/closures.vala \ diff --git a/tests/basic-types/bug729907.vala b/tests/basic-types/bug729907.vala new file mode 100644 index 000000000..fbbebb210 --- /dev/null +++ b/tests/basic-types/bug729907.vala @@ -0,0 +1,5 @@ +void main () { + assert (false ^ true == true); + assert (true ^ true == false); + assert (false ^ false == false); +} \ No newline at end of file diff --git a/vala/valabinaryexpression.vala b/vala/valabinaryexpression.vala index 8ccddba0d..0c9bf3243 100644 --- a/vala/valabinaryexpression.vala +++ b/vala/valabinaryexpression.vala @@ -355,8 +355,7 @@ public class Vala.BinaryExpression : Expression { } } else if (operator == BinaryOperator.MOD || operator == BinaryOperator.SHIFT_LEFT - || operator == BinaryOperator.SHIFT_RIGHT - || operator == BinaryOperator.BITWISE_XOR) { + || operator == BinaryOperator.SHIFT_RIGHT) { left.target_type.nullable = false; right.target_type.nullable = false; @@ -433,7 +432,8 @@ public class Vala.BinaryExpression : Expression { value_type = context.analyzer.bool_type; } else if (operator == BinaryOperator.BITWISE_AND - || operator == BinaryOperator.BITWISE_OR) { + || operator == BinaryOperator.BITWISE_OR + || operator == BinaryOperator.BITWISE_XOR) { // integer type or flags type left.target_type.nullable = false; right.target_type.nullable = false;