rust_hdl icon indicating copy to clipboard operation
rust_hdl copied to clipboard

[Clarification] No warning reported if object is not set

Open nselvara opened this issue 9 months ago • 3 comments

As an addendum to this issue: https://github.com/VHDL-LS/rust_hdl/issues/298 If one doesn't use/set the object (port, signal, variable), VHDL-LS correctly flags a warning that it's not set - all good :) . However, if the object is used for example as bla'sig_obj'subtype then the warning goes away even though the object is kind of not set. I'm not sure if that's a desirable feature to also output warning if the signal is not set rather than just used to get meta data.

nselvara avatar Apr 29 '24 09:04 nselvara

It's a good question whether this should be marked as an unused declaration or not. rust-analyzer does something similar when a variable is only used in recursion, so maybe vhdl_ls should emit an error in a similar fashion?

Schottkyc137 avatar May 03 '24 18:05 Schottkyc137

Or maybe, we introduce 2 kind of flags, which then indicates that the object is only used as a reference and the other one remains the same if it's not used.

nselvara avatar May 05 '24 19:05 nselvara

I found another one that's related to this:

This one flags that the index is not used.

variable bla: boolean;

function ret_bla(index: natural) return boolean is begin
  return true;
end function;

bla := ret_bla(0);

However, if you write the usage like this:

bla := ret_bla(index => 0);

The warning goes away even though the index is not used really.

nselvara avatar Jun 25 '24 13:06 nselvara