Open JHertz5 opened 1 week ago
The challenge here comes from nested subprograms. As mentioned on #1254, nested subprograms still have visibility of the parameters (or any other declaration, in fact) of the outer subprogram unless that parameter is hidden by another declaration that has the same identifier within the inner subprogram.
For example, the following would be correct output from this consistent case rule:
procedure my_proc1 (
i_param : in integer;
o_param : out integer
) is
procedure my_proc2 (
I_PARAM : in boolean
) is
begin
report to_string(I_PARAM) & to_string(o_param);
end procedure my_proc2;
begin
o_param := i_param;
end procedure my_proc1;
In this code, the my_proc2
would have visibility of o_param
of my_proc1
, but my_proc2
's parameter i_param
hides my_proc1
's i_param
within the scope of my_proc2
. This holds true for other declaration types as well. For example, the following would be correct output from this rule:
procedure my_proc1 (
i_param : in integer;
o_param : out integer
) is
procedure my_proc2 is
constant I_PARAM : integer := 1;
begin
report to_string(I_PARAM) & to_string(o_param);
end procedure my_proc2;
begin
o_param := i_param;
end procedure my_proc1;
Again, o_param
of my_proc1
is visible within the scope of my_proc2
, by i_param
of my_proc1
is hidden within the scope of my_proc2
by a constant that has the same identifier.
As a result, the steps that this consistent case rule needs to follow would look something like this:
Is your feature request related to a problem? Please describe. I would like to be able to enforce consistent case of parameter names in functions and procedures, e.g. correcting
to
Describe the solution you'd like I would like new rules to enforce consistent case for the cases described above.
Additional context This issue was split out from #1251, which is related to #1249. See this comment for details on how the solution for this issue may look.