From cf5dd5496ad30d135035651d398c209a42d0da30 Mon Sep 17 00:00:00 2001 From: Christoffer Lerno Date: Wed, 3 Dec 2025 21:54:06 +0100 Subject: [PATCH] @param name parsing too lenient #2614. --- releasenotes.md | 1 + src/compiler/parse_global.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/releasenotes.md b/releasenotes.md index f9f0915cb..50b65ef89 100644 --- a/releasenotes.md +++ b/releasenotes.md @@ -50,6 +50,7 @@ - Fix bug when converting from vector to distinct type of wider vector. #2604 - `$defined(hashmap.init(mem))` causes compiler segfault #2611. - Reference macro parameters syntax does not error in certain cases. #2612 +- @param name parsing too lenient #2614. ### Stdlib changes - Add `CGFloat` `CGPoint` `CGSize` `CGRect` types to core_foundation (macOS). diff --git a/src/compiler/parse_global.c b/src/compiler/parse_global.c index 0ffa82a90..7c3dad942 100644 --- a/src/compiler/parse_global.c +++ b/src/compiler/parse_global.c @@ -3075,15 +3075,15 @@ static inline bool parse_contract_param(ParseContext *c, AstId *docs, AstId **do case TOKEN_IDENT: case TOKEN_CT_IDENT: case TOKEN_TYPE_IDENT: - case TOKEN_CT_CONST_IDENT: case TOKEN_CT_TYPE_IDENT: - case TOKEN_CONST_IDENT: case TOKEN_HASH_IDENT: ast->contract_stmt.param.name = symstr(c); break; case TOKEN_ELLIPSIS: ast->contract_stmt.param.name = NULL; break; + case TOKEN_CT_CONST_IDENT: + case TOKEN_CONST_IDENT: default: RETURN_PRINT_ERROR_HERE("Expected a parameter name here."); }