Allow booleans to be assigned to a 1-bit bit field value

This commit is contained in:
gingerBill
2019-05-09 13:04:15 +01:00
parent a66612e8ae
commit 71a733e3b5
4 changed files with 28 additions and 9 deletions
+9
View File
@@ -268,10 +268,19 @@ Type *check_assignment_variable(CheckerContext *ctx, Operand *lhs, Operand *rhs)
return rhs->type;
}
}
} else if (rhs->value.kind == ExactValue_Bool) {
bool b = rhs->value.value_bool;
if (lhs_bits == 1) {
return rhs->type;
}
}
} else if (is_type_integer(rhs->type)) {
// TODO(bill): Any other checks?
return rhs->type;
} else if (is_type_boolean(rhs->type)) {
if (lhs_bits == 1) {
return rhs->type;
}
}
gbString lhs_expr = expr_to_string(lhs->expr);
gbString rhs_expr = expr_to_string(rhs->expr);