Skip to content

Validation for invalid assignment types in arguments #1228

@volsa

Description

@volsa

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    validationcandidate for syntactic or semantic validation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions