fix: oversight during underflow condition

fix: incorrect message format argument for index overflow
This commit is contained in:
Abderrahim Indjaren committed 2026-09-18 03:04:18 +01:00
1 parent 09c81c8a7f
commit d32bbfd7be
1 file changed
+3 -3
+3 -3
View File
@@ -10940,7 +10940,7 @@ gb_internal ExprKind check_compound_literal(CheckerContext *c, Operand *o, Ast *
continue;
}
if (index >= field_count) {
error(elem, "Too many values in structure literal, expected %td, got %td", field_count, cl->elems.count);
error(elem, "Too many values in structure literal, expected %td, got %td", field_count, index + 1);
break;
}
@@ -10988,9 +10988,9 @@ gb_internal ExprKind check_compound_literal(CheckerContext *c, Operand *o, Ast *
break ;
}
}
if (cl->elems.count < field_count) {
if (handled_elem_count < field_count) {
if (min_field_count < field_count) {
if (cl->elems.count < min_field_count) {
if (handled_elem_count < min_field_count) {
error(cl->close, "Too few values in structure literal, expected at least %td, got %td", min_field_count, handled_elem_count);
}
} else if (handled_elem_count != field_count) {