Runs on compatibility is too strict in Titan
Summary
To start a function on a component A, Titan requires the function to have a runs on clause for A or a parent of A. According to the standard, if the type of the component on which a function is started has all the elements with the same identifiers, types and restrictions as the runs on type of the function, this means runs on compatibility. This is described in Section 6.3.3, part 2.
Steps and/or TTCN-3 code to reproduce
type port mypt message{
inout integer
}with{extension "internal"}
type component broad{
port mypt P;
port mypt Q;
var integer i:=1;
var integer j:=2;
timer T:=3.0;
}
type component narrow{
port mypt P;
var integer i:=1;
timer T:=3.0;
}
function comp_comp_fn() runs on narrow{
P.receive(1);
i:=2;
P.send(2);
setverdict(pass);
}
testcase comp_comp_runson() runs on broad{
var broad n := broad.create;
connect(self:P,n:P);
n.start(comp_comp_fn());
P.send(1);
P.receive(2);
setverdict(pass);
}
What is the current bug behavior?
Compilation error.
What is the expected correct behavior?
Should pass. By replacing var broad n := broad.create;
with var narrow n := narrow.create;
it indeed, passes.
Relevant logs and/or screenshots
../src/assignments.ttcn:576.3: error: Component type mismatch: The component reference is of type `@assignments.broad', but function `@assignments.comp_comp_fn' runs on `@assignments.narrow'
Possible fixes
Titan version
8.1.0
Platform details (OS type and version)
Microsoft Windows 10 Enterprise 10.0.19042
/cc @aknappqwt @mmagyari
Edited by Adam Knapp