Add regression tests for duplicate class property names
Check that a class property cannot share a name with another property, a function, a task, a parameter, a type, or an enum named constant. Check duplicate properties in both separate and comma-separated declarations. The latter guards the shared declaration type ownership that previously caused a crash. Exercise properties in both declaration orders so both member registration paths are covered. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
This commit is contained in:
parent
7752cb8ec1
commit
1d2aa1b6fa
|
|
@ -0,0 +1,10 @@
|
|||
// Check that duplicate class property names are rejected.
|
||||
|
||||
module test;
|
||||
|
||||
class C;
|
||||
int value;
|
||||
static int value;
|
||||
endclass
|
||||
|
||||
endmodule
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
// Check that a class property and enum named constant cannot share a name.
|
||||
|
||||
module test;
|
||||
|
||||
class C;
|
||||
int value;
|
||||
typedef enum { value } value_t;
|
||||
endclass
|
||||
|
||||
endmodule
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
// Check that a class property and function cannot have the same name.
|
||||
|
||||
module test;
|
||||
|
||||
class C;
|
||||
int value;
|
||||
|
||||
function int value;
|
||||
return 0;
|
||||
endfunction
|
||||
endclass
|
||||
|
||||
endmodule
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
// Check that duplicate names in a class property declaration are rejected.
|
||||
|
||||
module test;
|
||||
|
||||
class C;
|
||||
int value, value;
|
||||
endclass
|
||||
|
||||
endmodule
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
// Check that a class property and parameter cannot have the same name.
|
||||
|
||||
module test;
|
||||
|
||||
class C;
|
||||
int value;
|
||||
localparam int value = 1;
|
||||
endclass
|
||||
|
||||
endmodule
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
// Check that a class property and task cannot have the same name.
|
||||
|
||||
module test;
|
||||
|
||||
class C;
|
||||
task value;
|
||||
endtask
|
||||
|
||||
int value;
|
||||
endclass
|
||||
|
||||
endmodule
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
// Check that a class property and type cannot have the same name.
|
||||
|
||||
module test;
|
||||
|
||||
class C;
|
||||
int value;
|
||||
typedef int value;
|
||||
endclass
|
||||
|
||||
endmodule
|
||||
|
|
@ -299,9 +299,16 @@ sv_class_nested_method_call vvp_tests/sv_class_nested_method_call.json
|
|||
sv_class_prop_assign_op1 vvp_tests/sv_class_prop_assign_op1.json
|
||||
sv_class_prop_assign_op2 vvp_tests/sv_class_prop_assign_op2.json
|
||||
sv_class_prop_class_name vvp_tests/sv_class_prop_class_name.json
|
||||
sv_class_prop_dup_fail vvp_tests/sv_class_prop_dup_fail.json
|
||||
sv_class_prop_enum_dup_fail vvp_tests/sv_class_prop_enum_dup_fail.json
|
||||
sv_class_prop_func_dup_fail vvp_tests/sv_class_prop_func_dup_fail.json
|
||||
sv_class_prop_list_dup_fail vvp_tests/sv_class_prop_list_dup_fail.json
|
||||
sv_class_prop_logic vvp_tests/sv_class_prop_logic.json
|
||||
sv_class_darray_prop_locators vvp_tests/sv_class_darray_prop_locators.json
|
||||
sv_class_prop_packed_dims vvp_tests/sv_class_prop_packed_dims.json
|
||||
sv_class_prop_param_dup_fail vvp_tests/sv_class_prop_param_dup_fail.json
|
||||
sv_class_prop_task_dup_fail vvp_tests/sv_class_prop_task_dup_fail.json
|
||||
sv_class_prop_type_dup_fail vvp_tests/sv_class_prop_type_dup_fail.json
|
||||
sv_class_prop_type_name vvp_tests/sv_class_prop_type_name.json
|
||||
sv_class_prop_wildcard_type_name vvp_tests/sv_class_prop_wildcard_type_name.json
|
||||
sv_class_queue_prop_locators vvp_tests/sv_class_queue_prop_locators.json
|
||||
|
|
|
|||
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"type" : "CE",
|
||||
"source" : "sv_class_prop_dup_fail.v",
|
||||
"iverilog-args" : [ "-g2005-sv" ]
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"type" : "CE",
|
||||
"source" : "sv_class_prop_enum_dup_fail.v",
|
||||
"iverilog-args" : [ "-g2005-sv" ]
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"type" : "CE",
|
||||
"source" : "sv_class_prop_func_dup_fail.v",
|
||||
"iverilog-args" : [ "-g2005-sv" ]
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"type" : "CE",
|
||||
"source" : "sv_class_prop_list_dup_fail.v",
|
||||
"iverilog-args" : [ "-g2005-sv" ]
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"type" : "CE",
|
||||
"source" : "sv_class_prop_param_dup_fail.v",
|
||||
"iverilog-args" : [ "-g2005-sv" ]
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"type" : "CE",
|
||||
"source" : "sv_class_prop_task_dup_fail.v",
|
||||
"iverilog-args" : [ "-g2005-sv" ]
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"type" : "CE",
|
||||
"source" : "sv_class_prop_type_dup_fail.v",
|
||||
"iverilog-args" : [ "-g2005-sv" ]
|
||||
}
|
||||
Loading…
Reference in New Issue