mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00:00
Disallow enumerated array literals without field = value
This commit is contained in:
@@ -8128,6 +8128,8 @@ ExprKind check_expr_base_internal(CheckerContext *c, Operand *o, Ast *node, Type
|
|||||||
if (cl->elems.count > 0 && cl->elems[0]->kind != Ast_FieldValue) {
|
if (cl->elems.count > 0 && cl->elems[0]->kind != Ast_FieldValue) {
|
||||||
if (0 < max && max < t->EnumeratedArray.count) {
|
if (0 < max && max < t->EnumeratedArray.count) {
|
||||||
error(node, "Expected %lld values for this enumerated array literal, got %lld", cast(long long)t->EnumeratedArray.count, cast(long long)max);
|
error(node, "Expected %lld values for this enumerated array literal, got %lld", cast(long long)t->EnumeratedArray.count, cast(long long)max);
|
||||||
|
} else {
|
||||||
|
error(node, "Enumerated array literals must only have 'field = value' elements, bare elements are not allowed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user