Record compatibility is too restrictive in Titan
Summary
Record compatibility requires type name equivalence while standard does not.
Steps and/or TTCN-3 code to reproduce
type record AType {
integer a(0..10) optional,
integer b(0..10) optional,
boolean c
}
type record BType {
integer a optional,
integer b(0..10) optional,
boolean c
}
type record CType {
// type with different field names
integer d optional,
integer e optional,
boolean f
}
type record DType {
// type with field c optional
integer a optional,
integer b optional,
boolean c optional
}
type record EType {
// type with an extra field d
integer a optional,
integer b optional,
boolean c,
float d optional
}
testcase record_comp() runs on ct_empty{
var AType v_myVarA := { -, 1, true};
var BType v_myVarB := { omit, 2, true};
var CType v_myVarC := { 3, omit, true};
v_myVarA := v_myVarB; //error
v_myVarC := v_myVarB; //error
v_myVarC := { d:= 20 };
v_myVarA := v_myVarC; //error
}
What is the current bug behavior?
Errors in the indicated lines.
What is the expected correct behavior?
These assignments shall succeed: Titan should only take into consideration the (written form of the) value that is assigned, not its type (and not the field names).
Relevant logs and/or screenshots
../src/datatypes.ttcn:553.3-22: In variable assignment:
../src/datatypes.ttcn:553.15-22: error: Type mismatch: a value of type `@datatypes.AType' was expected instead of `@datatypes.BType'
../src/datatypes.ttcn:554.3-22: In variable assignment:
../src/datatypes.ttcn:554.15-22: error: Type mismatch: a value of type `@datatypes.CType' was expected instead of `@datatypes.BType'
../src/datatypes.ttcn:558.3-22: In variable assignment:
../src/datatypes.ttcn:558.15-22: error: Type mismatch: a value of type `@datatypes.AType' was expected instead of `@datatypes.CType'
Possible fixes
Titan version
8.1.0
Platform details (OS type and version)
Microsoft Windows 10 Enterprise 10.0.19042
/cc @aknappqwt @mmagyari