mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-03 22:28:46 +00:00
Implement #1859
This commit is contained in:
+8
-2
@@ -3249,8 +3249,14 @@ void check_binary_expr(CheckerContext *c, Operand *x, Ast *node, Type *type_hint
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((op.kind == Token_CmpAnd || op.kind == Token_CmpOr) &&
|
||||||
if (!are_types_identical(x->type, y->type)) {
|
is_type_boolean(x->type) && is_type_boolean(y->type)) {
|
||||||
|
// NOTE(bill, 2022-06-26)
|
||||||
|
// Allow any boolean types within `&&` and `||`
|
||||||
|
// This is an exception to all other binary expressions since the result
|
||||||
|
// of a comparison will always be an untyped boolean, and allowing
|
||||||
|
// any boolean between these two simplifies a lot of expressions
|
||||||
|
} else if (!are_types_identical(x->type, y->type)) {
|
||||||
if (x->type != t_invalid &&
|
if (x->type != t_invalid &&
|
||||||
y->type != t_invalid) {
|
y->type != t_invalid) {
|
||||||
gbString xt = type_to_string(x->type);
|
gbString xt = type_to_string(x->type);
|
||||||
|
|||||||
Reference in New Issue
Block a user