redefinition-direction-conformance
Available in: KerML, SysML
This checks that directed features are only redefined by features with compatible directions.
inbyinoutbyoutinoutby any direction
Specification
If the
redefined_featureof aRedefinitionhas adirectionofinorout(relative to anyfeaturing_typeof theredefining_featureor theowning_type, if theredefining_featurehasis_variable = true), then theredefining_featuremust have the same direction. If theredefined_featurehas a direction ofinout, then theredefining_featuremust have a non-null direction. (Note: the direction of theredefined_featurerelative to afeaturing_typeof theredefining_featureis the direction it would have if it had been inherited and not redefined.)
Example
port def A {
in attribute a;
}
port b : A {
out attribute a :>> a; // error
}
Instead, use compatible directions:
port def A {
in attribute a;
}
port b : A {
in attribute a :>> a; // ok
}
Or use conjugated ports to reverse inherited directions:
port def A {
in attribute a;
}
port b : ~A {
out attribute a :>> a; // ok
}