rusty icon indicating copy to clipboard operation
rusty copied to clipboard

Function-Block inheritance fails when passing an inherited parameter to the call

Open riederm opened this issue 7 months ago • 0 comments

Describe the bug I cannot pass a parameter that was inherited

To Reproduce

        FUNCTION_BLOCK foo
          VAR_INPUT
              inherited : INT;
          END_VAR
        END_FUNCTION_BLOCK

        FUNCTION_BLOCK bar EXTENDS foo
          VAR_INPUT
              declared : INT;
          END_VAR
        END_FUNCTION_BLOCK

        FUNCTION Main
          VAR
              b : bar;
              x : INT;
          END_VAR

          b.inherited := 10;  // OK
          b(declared:=20);   // OK
          b(inherited:=10);   // Could not resolve reference to 'inherited'

        END_FUNCTION

Additional context Inherited IN_OUT and OUT variables must be considered as well.

Tests find the failing tests from above here: https://github.com/PLC-lang/rusty/tree/mari/issue__pass_inherited_parameter_in_call

riederm avatar Jun 02 '25 07:06 riederm