Incorrect code generated for anytype field reference in ispresent clause
Submitted by Botond Baranyi
Link to original bug (#495128)
Description
Example code: module mini {
type record Rec { integer num optional, charstring str }
control { var anytype x; x.Rec := { num := omit, str := "ab" }; if (not ispresent(x.Rec.num)) { // error: ‘class mini::anytype’ has no member named ‘Rec’ log("a"); } }
} with { extension "anytype integer, Rec"; }
Fault: When referencing a field of an anytype value inside an ispresent clause, the compiler generates a call to the incorrect field selection function Rec(). This would be correct for union fields, as the names of their selection functions are identical with the names of the fields; however, anytype field selection functions are prefixed with AT_ (AT_Rec()).
Version: 5.5.0