Fixes https://gitlab.gnome.org/GNOME/vala/issues/869
control-semantic/argument-owned-ref.test \
control-semantic/argument-value-out.test \
control-semantic/argument-value-ref.test \
+ control-semantic/condition-not-boolean.test \
+ control-semantic/expression-not-boolean.test \
control-semantic/literal-immutable.test \
control-semantic/member-incompatible-type.test \
control-semantic/member-invalid.test \
--- /dev/null
+Invalid Code
+
+void main () {
+ if (true != false & 0) {
+ assert_not_reached ();
+ }
+}
--- /dev/null
+Invalid Code
+
+void main () {
+ bool foo = true != false & 0;
+}
left.target_type.nullable = false;
right.target_type.nullable = false;
- value_type = left.target_type.copy ();
+ // Don't falsely resolve to bool
+ if (left.value_type.compatible (context.analyzer.bool_type)
+ && !right.value_type.compatible (context.analyzer.bool_type)) {
+ value_type = right.target_type.copy ();
+ } else {
+ value_type = left.target_type.copy ();
+ }
break;
case BinaryOperator.AND:
case BinaryOperator.OR: