mirror of
https://github.com/odin-lang/Odin.git
synced 2026-01-04 20:17:48 +00:00
Fix lower and upper values for a bit_set[Enum] type.
This commit is contained in:
@@ -986,8 +986,8 @@ void check_bit_set_type(CheckerContext *c, Type *type, Type *named_type, Ast *no
|
||||
error(bs->elem, "Enum type for bit_set must be an integer");
|
||||
return;
|
||||
}
|
||||
i64 lower = 0;
|
||||
i64 upper = 0;
|
||||
i64 lower = I64_MAX;
|
||||
i64 upper = I64_MIN;
|
||||
|
||||
for_array(i, et->Enum.fields) {
|
||||
Entity *e = et->Enum.fields[i];
|
||||
@@ -1001,6 +1001,10 @@ void check_bit_set_type(CheckerContext *c, Type *type, Type *named_type, Ast *no
|
||||
lower = gb_min(lower, x);
|
||||
upper = gb_max(upper, x);
|
||||
}
|
||||
if (et->Enum.fields.count == 0) {
|
||||
lower = 0;
|
||||
upper = 0;
|
||||
}
|
||||
|
||||
GB_ASSERT(lower <= upper);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user