From 34b0b6f8f909bf8e385cf0ef259b9693f3e10183 Mon Sep 17 00:00:00 2001 From: Christoffer Lerno Date: Fri, 15 Aug 2025 08:26:43 +0200 Subject: [PATCH] Fix for bug when `@format` encountered `*` in some cases. --- releasenotes.md | 1 + src/compiler/sema_expr.c | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/releasenotes.md b/releasenotes.md index 83bc2fb63..089f10200 100644 --- a/releasenotes.md +++ b/releasenotes.md @@ -36,6 +36,7 @@ - Functions being tested for overload are now always checked before test. - Compile time indexing at compile time in a $typeof was no considered compile time. - Slicing a constant array with designated initialization would not update the indexes. +- Fix for bug when `@format` encountered `*` in some cases. ### Stdlib changes - Add `==` to `Pair`, `Triple` and TzDateTime. Add print to `Pair` and `Triple`. diff --git a/src/compiler/sema_expr.c b/src/compiler/sema_expr.c index 6b3516ceb..ac75e2861 100644 --- a/src/compiler/sema_expr.c +++ b/src/compiler/sema_expr.c @@ -2135,6 +2135,7 @@ NEXT_FLAG: c = data[i]; if (++idx == vacount) goto TOO_FEW_ARGUMENTS; expr = vaargs[idx]; + type = sema_get_va_type(context, expr, variadic); if (!type_ok(type)) return false; } else @@ -7351,9 +7352,7 @@ static bool sema_expr_analyse_enum_add_sub(SemaContext *context, Expr *expr, Exp Decl **enums = left_type->decl->enums.values; if (int_is_neg(i) || int_ucomp(i, vec_size(enums), BINARYOP_GE)) { - SEMA_ERROR(expr, "This does not result in a valid enum. If you want to do the %s, cast the enum to an integer.", - is_sub ? "subtraction" : "addition"); - return false; + RETURN_SEMA_ERROR(expr, "This does not result in a valid enum. If you want to do the %s, cast the enum to an integer.", is_sub ? "subtraction" : "addition"); } ASSERT_SPAN(expr, left_type->decl->resolve_status == RESOLVE_DONE); expr->const_expr = (ExprConst) { .const_kind = CONST_ENUM, .enum_val = enums[int_to_i64(i)] };