From 8f6a9c5d3cb213c980373fef4d3b4354bbd3096f Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Fri, 8 Apr 2022 15:06:04 +0200 Subject: [PATCH] Require explicit data type for package variable declarations Variable declarations in packages need an explicit data type. Omitting the data type or using just packed dimensions is not valid syntax. E.g. the following should not work. ``` package P; x; [1:0] y; endpackage ``` The current implementation does accept this tough. To fix this update the parser to only allow explicit data types for package variable declarations. Signed-off-by: Lars-Peter Clausen --- parse.y | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/parse.y b/parse.y index 1e802d8a4..38fd60ddc 100644 --- a/parse.y +++ b/parse.y @@ -1177,7 +1177,7 @@ constraint_set /* IEEE1800-2005 A.1.9 */ ; data_declaration /* IEEE1800-2005: A.2.1.3 */ - : attribute_list_opt data_type_or_implicit list_of_variable_decl_assignments ';' + : attribute_list_opt data_type list_of_variable_decl_assignments ';' { data_type_t*data_type = $2; if (data_type == 0) { data_type = new vector_type_t(IVL_VT_LOGIC, false, 0);