diff options
| author | Wes Hardee <weshardee@gmail.com> | 2022-07-09 18:09:21 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-07-09 18:09:21 -0500 |
| commit | 00739bf06dc73a88a320baec01a3844fbf9f59a9 (patch) | |
| tree | 157cca02510cd90f6c092ae99c50056342bc7532 /src/check_expr.cpp | |
| parent | 23842a8950be99afca4f4180aca95a7c2da771dc (diff) | |
| parent | e8148055ad78489832c55aab9b81edd694440d63 (diff) | |
Merge branch 'odin-lang:master' into master
Diffstat (limited to 'src/check_expr.cpp')
| -rw-r--r-- | src/check_expr.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/check_expr.cpp b/src/check_expr.cpp index 58972d2cf..b42301cd6 100644 --- a/src/check_expr.cpp +++ b/src/check_expr.cpp @@ -3249,8 +3249,14 @@ void check_binary_expr(CheckerContext *c, Operand *x, Ast *node, Type *type_hint return; } - - if (!are_types_identical(x->type, y->type)) { + if ((op.kind == Token_CmpAnd || op.kind == Token_CmpOr) && + 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 && y->type != t_invalid) { gbString xt = type_to_string(x->type); |