From ff0b4a3154913fdf2af164ab5e5746f65ede2cec Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Sun, 5 Jul 2026 21:17:10 -0700 Subject: [PATCH] parser: Fix parameter assignment grammar conflict The parameter declaration grammar allows a visible type identifier to be used as a parameter name. The assignment continuation rule still used `identifier_name`, which made Bison reduce a `TYPE_IDENTIFIER` before it had seen whether following dimensions belonged to the parameter name or to an explicit type identifier. Match ordinary and type identifiers directly in `parameter_assign` so the parser can shift dimensions before deciding between a parameter name and an explicit parameter type. Fixes: e56c93a2be56 ("Support shadowing type identifiers in parameter declarations") Signed-off-by: Lars-Peter Clausen --- parse.y | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/parse.y b/parse.y index 1a67658d2..f94ceccf1 100644 --- a/parse.y +++ b/parse.y @@ -5991,10 +5991,17 @@ value_parameter_assign_with_explicit_type ; parameter_assign - : identifier_name dimensions_opt initializer_opt parameter_value_ranges_opt - { pform_set_parameter(@1, $1, param_is_local, + : IDENTIFIER dimensions_opt initializer_opt parameter_value_ranges_opt + { pform_set_parameter(@1, lex_strings.make($1), param_is_local, param_is_type, param_type_restrict, param_data_type, $2, $3, $4); + delete[]$1; + } + | TYPE_IDENTIFIER dimensions_opt initializer_opt parameter_value_ranges_opt + { pform_set_parameter(@1, lex_strings.make($1.text), param_is_local, + param_is_type, param_type_restrict, + param_data_type, $2, $3, $4); + delete[]$1.text; } ;