From add1e6849a58ca69b614635d90b7b700e023cefa Mon Sep 17 00:00:00 2001 From: Sylphrena Date: Wed, 9 Sep 2026 20:25:47 +0200 Subject: [PATCH] Improve error message for constant indexing --- src/check_expr.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/check_expr.cpp b/src/check_expr.cpp index 35666bf5a..e66db6ab3 100644 --- a/src/check_expr.cpp +++ b/src/check_expr.cpp @@ -12209,9 +12209,9 @@ gb_internal ExprKind check_index_expr(CheckerContext *c, Operand *o, Ast *node, if (index < 0) { ERROR_BLOCK(); gbString str = expr_to_string(o->expr); - error(o->expr, "Cannot index a constant '%s'", str); + error(o->expr, "Cannot index a constant '%s' with a variable index", str); if (!build_context.terse_errors) { - error_line("\tSuggestion: store the constant into a variable in order to index it with a variable index\n"); + error_line("\tSuggestion: store the constant into a variable or index it with a constant\n"); } gb_string_free(str); o->mode = Addressing_Invalid;