Comparison with omit causes compilation error
Submitted by Botond Baranyi
Link to original bug (#498430)
Description
Comparing a record/set field with the value 'omit' causes a compilation error if the comparision is part of a variable assignment.
Example: type component CompType {} type record MyRecord { integer a optional } testcase testTC() runs on CompType { var MyRecord myRecord := { a := omit } log(myRecord.a == omit); // works fine var boolean b := myRecord.a == omit; // error: `omit' value is not allowed in this context }
The error is displayed during the variable assignment's self-reference check (which is not done for log arguments). Whether the value 'omit' is comparable to the other operand is checked later in the semantic analysis.
Solution: Allow the value 'omit' to appear during the self-reference check, since this is checked later.
Version: 5.5.0