Add regression tests for accessing imported identifiers through hierarchical names
Check that an error is reported when trying to access an imported identifier through a hierarchical name. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
This commit is contained in:
parent
f4d55081ed
commit
f9a0e2f401
|
|
@ -0,0 +1,24 @@
|
|||
// Check that imported identifiers can't be accessed through hierarchical names.
|
||||
|
||||
package P;
|
||||
integer x;
|
||||
endpackage
|
||||
|
||||
module M;
|
||||
import P::x;
|
||||
integer y;
|
||||
always_comb y = x;
|
||||
endmodule
|
||||
|
||||
module test;
|
||||
|
||||
M m ();
|
||||
|
||||
initial begin
|
||||
integer y;
|
||||
y = m.x; // This should fail. Imported identifiers are not visible through
|
||||
// hierarchical names.
|
||||
$display("FAILED");
|
||||
end
|
||||
|
||||
endmodule
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
// Check that imported identifiers can't be accessed through hierarchical names.
|
||||
|
||||
package P;
|
||||
integer x;
|
||||
endpackage
|
||||
|
||||
module M;
|
||||
import P::*;
|
||||
integer y;
|
||||
always_comb y = x;
|
||||
endmodule
|
||||
|
||||
module test;
|
||||
|
||||
M m ();
|
||||
|
||||
initial begin
|
||||
integer y;
|
||||
y = m.x; // This should fail. Imported identifiers are not visible through
|
||||
// hierarchical names.
|
||||
$display("FAILED");
|
||||
end
|
||||
|
||||
endmodule
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
// Check that imported identifiers can't be accessed through hierarchical names.
|
||||
|
||||
package P;
|
||||
integer x;
|
||||
endpackage
|
||||
|
||||
module test;
|
||||
|
||||
initial begin : outer
|
||||
integer y;
|
||||
begin: inner
|
||||
import P::x;
|
||||
y = x;
|
||||
end
|
||||
y = inner.x; // This should fail. Imported identifiers are not visible
|
||||
// through hierarchical names.
|
||||
$display("FAILED");
|
||||
end
|
||||
|
||||
endmodule
|
||||
|
|
@ -656,6 +656,9 @@ sv_foreach8 normal,-g2009 ivltests gold=sv_foreach8.gold
|
|||
sv_foreach_fail1 CE,-g2009 ivltests
|
||||
sv_immediate_assert normal,-g2009 ivltests gold=sv_immediate_assert.gold
|
||||
sv_immediate_assume normal,-g2009 ivltests gold=sv_immediate_assume.gold
|
||||
sv_import_hier_fail1 CE,-g2005-sv ivltests
|
||||
sv_import_hier_fail2 CE,-g2005-sv ivltests
|
||||
sv_import_hier_fail3 CE,-g2005-sv ivltests
|
||||
sv_macro normal,-g2009 ivltests
|
||||
sv_macro2 normal,-g2009 ivltests gold=sv_macro2.gold
|
||||
sv_macro3a normal,-g2009 ivltests gold=sv_macro3.gold
|
||||
|
|
|
|||
Loading…
Reference in New Issue