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 <lars@metafoo.de>
This commit is contained in:
Lars-Peter Clausen 2022-04-08 15:06:04 +02:00
parent 42de9e646a
commit 8f6a9c5d3c
1 changed files with 1 additions and 1 deletions

View File

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