Skip to content

Validation for invalid assignment types in arguments #1228

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

Open
volsa opened this issue May 23, 2024 · 0 comments
Open

Validation for invalid assignment types in arguments #1228

volsa opened this issue May 23, 2024 · 0 comments
Labels
validation candidate for syntactic or semantic validation

Comments

@volsa
Copy link
Member

volsa commented May 23, 2024

Describe the bug
We're missing a validation for invalid assignment statements in arguments (:=, =>), specifically the following should return an error

FUNCTION_BLOCK foo
    VAR_OUTPUT
        out_val : DINT;
    END_VAR
END_FUNCTION_BLOCK

FUNCTION main
    VAR
        foo_instance    : foo;
        out_val_local   : DINT;
    END_VAR

    foo_instance(out_val := out_val_local);
//                       ^^ should have been a `=>`
END_FUNCTION

With #1214 this will silently generate invalid code. For reference, CodeSys will return a "'out_val' is no input of foo" error here.

(I think the same should also happen for INPUT values, i.e. where a user typed => instead of :=, but CodeSys doesn't return an error for this)

@volsa volsa added the validation candidate for syntactic or semantic validation label May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
validation candidate for syntactic or semantic validation
Projects
None yet
Development

No branches or pull requests

1 participant