rusty icon indicating copy to clipboard operation
rusty copied to clipboard

Add validation for math operations with incompatible types

Open mhasel opened this issue 2 years ago • 0 comments

Is your feature request related to a problem? Please describe. When trying to compile code with a binary statement which involves math operators with incompatible types, we currently do not validate against it and the compilation will fail during codegen.

FUNCTION main : DINT
        VAR
            x1 : ARRAY[0..2] OF TOD;
            x2 : STRING;
        END_VAR
            x1 + x2;
            ADD(x1, x1);
            DIV(x1, x2);
            SUB(x2, x2);
END_FUNCTION

Describe the solution you'd like We should validate if the operation can be performend on the two types in the binary expression

mhasel avatar Nov 27 '23 10:11 mhasel