default union field does not work
Summary
Union field shall be able to be annotated as @default. In this case, a union data element can be assigned a value without explicitly identifying the field name. Titan does not support this right now.
Steps and/or TTCN-3 code to reproduce
Create a module with the following contents:
type union myut{
@default
integer field1,
charstring field2
}
testcase union_def() runs on ct_empty{
var myut v;
v.field1 := 1;
v.field2 := "a";
v := {field1:=2};
v := {field2:="b"};
//v := 3; //error
v.field1 := 3;
v := 4;
if(v.field1==4){setverdict(pass);}
}
Compile.
What is the current bug behavior?
Titan does not recognize the @default annotation.
What is the expected correct behavior?
The above code should run and pass. When the (uncommented) v:=3 row is processed, it should yield an error, as value assignment is only possible without identifying the union field if the default field is the chosen field at that point in time. For the same reason, the v := 4 row should not cause an error, as right before it field1 was chosen.
Relevant logs and/or screenshots
Possible fixes
Titan version
8.1.0
Platform details (OS type and version)
Microsoft Windows 10 Enterprise 10.0.19042
/cc @aknappqwt