Add regression tests for package scoped function call errors

Check that an error is reported, rather than crashing, when trying to do a
package scoped function call when the function does not exist in the
package or is not a function.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
This commit is contained in:
Lars-Peter Clausen 2022-12-25 15:37:48 -08:00
parent 43443dd7d1
commit 5563dc6250
4 changed files with 51 additions and 0 deletions

View File

@ -0,0 +1,15 @@
// Check that an error is reported when trying to call a package scoped function
// that does not exist.
package P;
endpackage
module test;
initial begin
int y;
y = P::f(10); // This should fail, f does not exist
$display("FAILED");
end
endmodule

View File

@ -0,0 +1,16 @@
// Check that trying to call a package scoped variable as a function results in
// an error.
package P;
int x;
endpackage
module test;
initial begin
int y;
y = P::x(10); // This should fail, x is not a function
$display("FAILED");
end
endmodule

View File

@ -0,0 +1,17 @@
// Check that an error is reported when trying to call a package scoped task as
// a function.
package P;
task t(int x);
endtask
endpackage
module test;
initial begin
int y;
y = P::t(10); // This should fail, t is a task
$display("FAILED");
end
endmodule

View File

@ -692,6 +692,9 @@ sv_ps_function4 normal,-g2009 ivltests
sv_ps_function5 normal,-g2009 ivltests
sv_ps_function6 normal,-g2009 ivltests
sv_ps_function7 normal,-g2009 ivltests
sv_ps_function_fail1 CE,-g2009 ivltests
sv_ps_function_fail2 CE,-g2009 ivltests
sv_ps_function_fail3 CE,-g2009 ivltests
sv_ps_member_sel1 normal,-g2009 ivltests
sv_ps_member_sel2 normal,-g2009 ivltests
sv_ps_member_sel3 normal,-g2009 ivltests