Enumerated compatibility doesn't work as expected.
Summary
Enumerated values can be compatible according to the current TTCN-3 standard, but TITAN does now know that.
Steps and/or TTCN-3 code to reproduce
type enumerated EWeekDays {
Mon, Tue, Wed, Thu, Fri, Sat, Sun
};
type enumerated EWorkDays {
Mon, Tue, Wed, Thu, Fri
};
control{
var EWeekDays v_myWeekDayMon := Mon
var EWorkDays v_myWorkDayMon := Mon
v_myWorkDayMon := v_myWeekDayMon
}
What is the current bug behavior?
Compilation fails, as the RHS of the assignment has a different type to that of the LHS of the assignment.
What is the expected correct behavior?
The code should be compiled as the RHS of the assignment is compatible with the type of the LHS of the assignment, because the value on the RHS is defined in the type of the LHS, and is defined with the same associated integer. (Section 6.3.2.1)
Relevant logs and/or screenshots
**************************************************************
2022-05-13_16:21:52: starting to build address
**************************************************************
sh -c make dep
/home/lee/git/titan.core/Install/bin/compiler \
../src/maptest.ttcn ../src/subtypes.ttcn - ../src/maptest.ttcn ../src/subtypes.ttcn
Notify: Parsing TTCN-3 module `../src/maptest.ttcn'...
Notify: Parsing TTCN-3 module `../src/subtypes.ttcn'...
Notify: Checking modules...
../src/maptest.ttcn: In TTCN-3 module `maptest':
../src/maptest.ttcn:11.1-15.1: In control part:
../src/maptest.ttcn:14.3-34: In variable assignment:
../src/maptest.ttcn:14.21-34: error: Type mismatch: a value of type `@maptest.EWorkDays' was expected instead of `@maptest.EWeekDays'
Notify: Error found in the input modules. Code will not be generated.
make: *** [Makefile:154: compile] Error 1
Operation failed with return value: 2
Possible fixes
If a value 'a' from enumerated type 'A' is assigned to a data element of enumerated type 'B' then the assignment shall be successful if 'a' is defined in enumerated type 'B' as well, and is defined with the same associated integer as in 'A'. (See 6.2.4, EXAMPLE 3 mainly)
Titan version
8.1.0
Platform details (OS type and version)
Microsoft Windows 10 Enterprise 10.0.19042
/cc @aknappqwt