rusty icon indicating copy to clipboard operation
rusty copied to clipboard

Validation for shadowed variables

Open volsa opened this issue 1 year ago • 0 comments

Is your feature request related to a problem? Please describe. Currently the the following code compiles without any info / warning messages but it isn't clear which x value is meant in the assignment y := x.

VAR_GLOBAL CONSTANT
    x : DINT := 0;
END_VAR

PROGRAM main
    VAR
        x : DINT := 10;
        y : DINT;
    END_VAR
    y := x;
END_PROGRAM

Describe the solution you'd like Give a warning that the global x variable is shadowed by the local one (or vice-versa, depending on how we define the behavior of such cases).

volsa avatar Mar 27 '24 09:03 volsa