Community
Participate
Working Groups
For the given annotion/enum definitions: Enumeration TestEnum Fred, Wilma, Barney end record TestAnn type annotation { targets=[FieldMbr] } fredField TestEnum = TestEnum.Fred; wilmaField TestEnum = TestEnum.Wilma; intField int = 3; strField string = "string"; end record TestAnn2 type annotation { targets=[FieldMbr] } value TestEnum?; end Define the following Library: library lib1 field1 int {@TestAnn{intField = 55555}}; field2 int {@TestAnn{fredField = TestEnum.Barney}}; field3 int {@TestAnn{wilmaField = Barney}}; field4 int {testann2 = fred}; field5 int {@testann2{wilma}}; end If you look at the IR generated, all of the references to the enumerations are MemberAccess, except the one for fiel4. This annotation's value field is set to the string "Fred". The IR value for this field is actually the EnumerationEntry. Because of this, any users of the Lib1 IR would need to check for 2 different types of annotation values. This needs to be changed to be consistant. The value of an annotion field with an Enumeration should always be the EnumerationEnty for this scenerio.
This has been fixed. Initial values of annotation fields, when initialized to an enumeration or array of enumerations will contain the expressions. When the annotation is instantiated, the initialization code for the Annotation will convert these initial values from an expression and resolve the actual enumeration value (EnumerationEntry) based on the type of the annotation field.
excellent