mirror of
https://github.com/odin-lang/Odin.git
synced 2026-07-11 02:19:30 +00:00
Report range type correctly on out-of-bounds
This commit is contained in:
@@ -5363,7 +5363,8 @@ gb_internal bool check_index_value(CheckerContext *c, Type *main_type, bool open
|
||||
TEMPORARY_ALLOCATOR_GUARD();
|
||||
String idx_str = big_int_to_string(temporary_allocator(), &i);
|
||||
gbString expr_str = expr_to_string(operand.expr, temporary_allocator());
|
||||
error(operand.expr, "Index '%s' is out of bounds range 0..<%lld, got %.*s", expr_str, max_count, LIT(idx_str));
|
||||
char range_type = open_range ? '=' : '<';
|
||||
error(operand.expr, "Index '%s' is out of bounds range 0..%c%lld, got %.*s", expr_str, range_type, max_count, LIT(idx_str));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user