rusty
rusty copied to clipboard
Unusual assignment diagnostic when trying to call `ADR` on qualified action reference
Describe the bug
While testing edge cases for #1165 i came across an unsual assignment diagnostic.
Trying to get the address of a qualified action reference ADR(FOO.BAR) validates an assignment of BAR to FOO.
To Reproduce
PROGRAM prog
VAR
fb : FOO;
address: LWORD;
END_VAR
address := ADR(fb.BAR);
END_PROGRAM
FUNCTION_BLOCK FOO
END_FUNCTION_BLOCK
ACTIONS
ACTION BAR
END_ACTION
END_ACTIONS
This will result in
error[E037]: Invalid assignment: cannot assign 'BAR' to 'FOO'
┌─ target/demo.st:6:21
│
6 │ address := ADR(fb.BAR);
│ ^^^^^^^ Invalid assignment: cannot assign 'BAR' to 'FOO'
Expected behavior Being able to get the address of the instanced action without diagnostics.