PLC-lang/rusty

using `__VOID` as a type in user code should be an error

Open

#1,348 opened on Oct 24, 2024

 (1 comment) (0 reactions) (0 assignees)Rust (71 forks)auto 404
good first issuemedium-priority

Repository metrics

Stars
 (351 stars)
PR merge metrics
 (PR metrics pending)

Description

We currently do not have a validation in place to safeguard against initializing a variable with __VOID. Since the void type does not exist outside of return-types in LLVM, the variable's type is then changed to i32 during codegen. I think it would make sense to disallow using the type in user code in general, especially seeing as it is prefixed with __.

FUNCTION_BLOCK foo
VAR
    x : __VOID;
END_VAR
END_FUNCTION_BLOCK

...

%foo = type { i32 }

Contributor guide