From 443ee75ccdf919c93a9fa969157d5f758afd2e8e Mon Sep 17 00:00:00 2001 From: Christoffer Lerno Date: Fri, 27 Feb 2026 01:23:04 +0100 Subject: [PATCH] - `@deprecated` in function contracts would be processed twice, causing a compilation error despite being correct. --- releasenotes.md | 2 +- src/compiler/parse_global.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/releasenotes.md b/releasenotes.md index c4baad27a..a1191a05c 100644 --- a/releasenotes.md +++ b/releasenotes.md @@ -10,7 +10,7 @@ - Add contract on `any_to_enum_ordinal` and `any_to_int` to improve error when passed an empty any. #2977 ### Fixes -None +- `@deprecated` in function contracts would be processed twice, causing a compilation error despite being correct. ## 0.7.10 Change list diff --git a/src/compiler/parse_global.c b/src/compiler/parse_global.c index ed64cfccf..c198d80bb 100644 --- a/src/compiler/parse_global.c +++ b/src/compiler/parse_global.c @@ -1958,6 +1958,7 @@ static bool parse_element_contract(ParseContext *c, ContractDescription *contrac INLINE void attach_deprecation_from_contract(ParseContext *c, ContractDescription *contract, Decl *decl) { if (contract->deprecated) vec_add(decl->attributes, contract->deprecated); + contract->deprecated = NULL; } /** @@ -3649,6 +3650,7 @@ Decl *parse_top_level_statement(ParseContext *c, ParseContext **context_out) break; case TOKEN_FN: decl = parse_func_definition(c, &contracts, c->unit->is_interface_file ? FUNC_PARSE_C3I : FUNC_PARSE_REGULAR); + break; case TOKEN_CT_ASSERT: {