PLC-lang / rusty

Structured Text Parser and LLVM Frontend
GNU Lesser General Public License v3.0
223 stars 53 forks source link

Using the removed `&` - operator in a formal parameter assignment will cause an error during codegen #1306

Open mhasel opened 2 months ago

mhasel commented 2 months ago

When trying to formally assign an input-parameter with the removed address-of operator &, --check will not report any errors.

VAR_GLOBAL
        global : DINT;
END_VAR

  PROGRAM prog
      VAR_INPUT
          input : REF_TO DINT;
      END_VAR
  END_PROGRAM

FUNCTION main : DINT
        prog(input := &global);
END_FUNCTION

The compilation will fail during codegen with:

error[E071]: no type hint available for EmptyStatement
   ┌─ target/demo.st:12:23
   │
12 │         prog(input := &global);
   │                       ^ no type hint available for EmptyStatement

Compilation aborted due to previous errors.