rusty icon indicating copy to clipboard operation
rusty copied to clipboard

Allow bit-access to bit-access assignment in arguments

Open volsa opened this issue 1 year ago • 0 comments

Describe the bug Should we support the following example, where the assignments are semantically similar but one will generate an error and one will not. I guess this is more of a discussion than an issue, and a good example for why AST lowering would be nice to have.

FUNCTION_BLOCK FOO
    VAR_OUTPUT
        Q : BYTE;
    END_VAR
END_FUNCTION_BLOCK

FUNCTION main : DINT
    VAR
        error_bits : BYTE;
        f : FOO;
    END_VAR

    f(Q.3 => error_bits.4); // This will yield errors ("Invalid call parameters", "Expression is not assignable")
    
    // This will not yield any errors, but it is semantically similar to the above function call
    error_bits.3 := error_bits.4;

END_FUNCTION

volsa avatar Apr 23 '24 12:04 volsa