diff options
| author | gingerBill <bill@gingerbill.org> | 2023-05-18 11:26:57 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2023-05-18 11:26:57 +0100 |
| commit | 49d1f6aca03672469d8fda0dedd27e330e698edc (patch) | |
| tree | f762ab6c9b9d5ae0d374eda0b31a3c164fc94455 /src/check_expr.cpp | |
| parent | e82146bf17908dcc3619c8ec34bb0e902d7c213d (diff) | |
| parent | 49cd9648b05c6eda252122104cb9b1faa2502602 (diff) | |
Merge branch 'master' into separate-int-word-sizes
Diffstat (limited to 'src/check_expr.cpp')
| -rw-r--r-- | src/check_expr.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/check_expr.cpp b/src/check_expr.cpp index 6eb517251..0db12aba0 100644 --- a/src/check_expr.cpp +++ b/src/check_expr.cpp @@ -7887,8 +7887,11 @@ gb_internal ExprKind check_or_return_expr(CheckerContext *c, Operand *o, Ast *no rhs.type = right_type; rhs.mode = Addressing_Value; - // TODO(bill): better error message - if (!check_is_assignable_to(c, &rhs, end_type)) { + if (is_type_boolean(right_type) && is_type_boolean(end_type)) { + // NOTE(bill): allow implicit conversion between boolean types + // within 'or_return' to improve the experience using third-party code + } else if (!check_is_assignable_to(c, &rhs, end_type)) { + // TODO(bill): better error message gbString a = type_to_string(right_type); gbString b = type_to_string(end_type); gbString ret_type = type_to_string(result_type); |