nickg / nvc

VHDL compiler and simulator
https://www.nickg.me.uk/nvc/
GNU General Public License v3.0
589 stars 75 forks source link

Package Alias #893

Closed bpadalino closed 1 month ago

bpadalino commented 1 month ago

Playing with packages again and I came across this error, which I believe is legal.

package inner is

    constant a : integer := 42 ;

end package ;

package outer is

    alias inner is work.inner ;

end package ;

use work.outer.all ;

entity test is
end entity ;

architecture arch of test is

begin

    tb : process
    begin
        report "a: " & to_string(inner.a) ;
        std.env.stop ;
    end process ;

end architecture ;

nvc gives me this error:

$ nvc --std=2008 -a test.vhdl 
** Error: invalid use of package WORK.INNER
   > test.vhdl:9
   |
 1 | package inner is
   | ^ name INNER refers to this package
 ...
 9 |     alias inner is work.inner ;
   |                    ^^^^^^^^^^ error occurred here
** Error: design unit depends on WORK.OUTER which was analysed with errors
    > test.vhdl:13
    |
 13 | use work.outer.all ;
    | ^^^^^^^^^^^^^^^^^^
** Error: design unit depends on WORK.TEST which was analysed with errors
    > test.vhdl:18
    |
 18 | architecture arch of test is
    |                      ^^^^

Works in Riviera and Questa.