Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validation for shadowed variables #1179

Open
volsa opened this issue Mar 27, 2024 · 0 comments
Open

Validation for shadowed variables #1179

volsa opened this issue Mar 27, 2024 · 0 comments
Labels
enhancement New feature or request low-priority validation candidate for syntactic or semantic validation

Comments

@volsa
Copy link
Member

volsa commented Mar 27, 2024

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 volsa added enhancement New feature or request validation candidate for syntactic or semantic validation low-priority labels Mar 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request low-priority validation candidate for syntactic or semantic validation
Projects
None yet
Development

No branches or pull requests

1 participant