Fix for bug when @format encountered * in some cases.

This commit is contained in:
Christoffer Lerno
2025-08-15 08:26:43 +02:00
parent 4fea202e6d
commit 34b0b6f8f9
2 changed files with 3 additions and 3 deletions

View File

@@ -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`.

View File

@@ -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)] };