aboutsummaryrefslogtreecommitdiff
path: root/src/check_stmt.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/check_stmt.cpp')
-rw-r--r--src/check_stmt.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/check_stmt.cpp b/src/check_stmt.cpp
index d31af08da..a6ca4b9dd 100644
--- a/src/check_stmt.cpp
+++ b/src/check_stmt.cpp
@@ -1544,7 +1544,11 @@ gb_internal void check_range_stmt(CheckerContext *ctx, Ast *node, u32 mod_flags)
}
} else if (operand.mode != Addressing_Invalid) {
if (operand.mode == Addressing_OptionalOk || operand.mode == Addressing_OptionalOkPtr) {
- check_promote_optional_ok(ctx, &operand, nullptr, nullptr);
+ Type *end_type = nullptr;
+ check_promote_optional_ok(ctx, &operand, nullptr, &end_type, false);
+ if (is_type_boolean(end_type)) {
+ check_promote_optional_ok(ctx, &operand, nullptr, &end_type, true);
+ }
}
bool is_ptr = is_type_pointer(operand.type);
Type *t = base_type(type_deref(operand.type));