rusty icon indicating copy to clipboard operation
rusty copied to clipboard

better error message for array of struct initialization

Open rarris opened this issue 1 year ago • 1 comments

if we write the wrong parentheses for the array initialization, we get only a general error message

PROGRAM mainProg
VAR
testARR : struct_io := [val1:=TRUE,val2:=1]; //not ok
testARR : struct_io := (val1:=TRUE,val2:=1); //OK
END_VAR
END_PROGRAM

TYPE struct_io :
 	STRUCT
		val1 : BOOL;
		val2 : INT;  
		val3 : SINT;
	END_STRUCT
END_TYPE

error: Some initial values were not generated Error: E071: Compilation aborted due to previous errors

rarris avatar Mar 06 '24 08:03 rarris

We should return an invalid assignment error here and also give a suggestion to replace [] with () as is the case with array initializers.

volsa avatar Mar 21 '24 15:03 volsa