Add regression tests for procedural labels shadowing type identifiers

Check that a visible type identifier can be reused as a procedural assertion
label after a declaration in both task and block bodies. These are the contexts
where label and declaration parsing meet.

Also check that a null statement ends the declaration portion of a procedural
body and a following declaration is rejected.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
This commit is contained in:
Lars-Peter Clausen 2026-06-27 09:40:05 -07:00
parent da26dc89f6
commit 3f875f72f0
5 changed files with 44 additions and 0 deletions

View File

@ -0,0 +1,10 @@
// Check that a declaration after a null statement is rejected.
module test;
initial begin
;
integer value;
end
endmodule

View File

@ -0,0 +1,22 @@
// Check that assertion labels can shadow type identifiers after declarations.
typedef reg [7:0] CHECK;
module test;
task check_task;
CHECK value;
CHECK: assert (1);
endtask
initial begin
begin
CHECK value;
CHECK: assert (1);
end
check_task;
$display("PASSED");
end
endmodule

View File

@ -309,6 +309,7 @@ sv_const_fail8 vvp_tests/sv_const_fail8.json
sv_const_fail9 vvp_tests/sv_const_fail9.json
sv_darray_assign_op vvp_tests/sv_darray_assign_op.json
sv_darray_find_locators vvp_tests/sv_darray_find_locators.json
sv_declaration_after_null_statement_fail vvp_tests/sv_declaration_after_null_statement_fail.json
sv_default_port_value1 vvp_tests/sv_default_port_value1.json
sv_default_port_value2 vvp_tests/sv_default_port_value2.json
sv_default_port_value3 vvp_tests/sv_default_port_value3.json
@ -406,6 +407,7 @@ sv_soft_packed_union_fail1 vvp_tests/sv_soft_packed_union_fail1.json
sv_string_method_substr_too_few_arg_fail vvp_tests/sv_string_method_substr_too_few_arg_fail.json
sv_super_member_fail vvp_tests/sv_super_member_fail.json
sv_type_identifier_ams_name_fields vvp_tests/sv_type_identifier_ams_name_fields.json
sv_type_identifier_assert_label vvp_tests/sv_type_identifier_assert_label.json
sv_type_identifier_attribute_name vvp_tests/sv_type_identifier_attribute_name.json
sv_type_identifier_attribute_target vvp_tests/sv_type_identifier_attribute_target.json
sv_type_identifier_block_label_name vvp_tests/sv_type_identifier_block_label_name.json

View File

@ -0,0 +1,5 @@
{
"type" : "CE",
"source" : "sv_declaration_after_null_statement_fail.v",
"iverilog-args" : [ "-g2005-sv" ]
}

View File

@ -0,0 +1,5 @@
{
"type" : "normal",
"source" : "sv_type_identifier_assert_label.v",
"iverilog-args" : [ "-g2005-sv" ]
}