Merge pull request #673 from larsclausen/package-no-implicit-var

Require explicit data type for package variable declarations
This commit is contained in:
Stephen Williams 2022-04-10 15:06:26 -07:00 committed by GitHub
commit 7c5694e516
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 1 deletions

View File

@ -0,0 +1,6 @@
// Check that it is not possible to declare a variable in a package without an explicit data
// type for the variable.
pacakge P;
x; // This is a syntax error
endpackage

View File

@ -0,0 +1,6 @@
// Check that it is not possible to declare a variable in a package without an explicit data
// type for the variable.
pacakge P;
[3:0] x; // This is a syntax error
endpackage

View File

@ -536,6 +536,8 @@ sv_package2 normal,-g2009 ivltests
sv_package3 normal,-g2009 ivltests
sv_package4 normal,-g2009 ivltests
sv_package5 normal,-g2009 ivltests
sv_package_implicit_var1 CE,-g2009 ivltests
sv_package_implicit_var2 CE,-g2009 ivltests
sv_packed_port1 normal,-g2009 ivltests
sv_packed_port2 normal,-g2009 ivltests
sv_param_port_list normal,-g2009 ivltests

View File

@ -1161,7 +1161,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);