subsetting-constant-conformance
Available in: KerML, SysML
This checks that variable subsetting features are also constant if they
subset a constant feature.
Specification
If the
subsetted_featureof aSubsettinghasis_constant = trueand thesubsetting_featurehasis_variable = true, then thesubsetting_featuremust haveis_constant = true.
Example
This can be triggered in KerML by setting incompatible var and const:
class A { const feature a; }
class B :> A {
var feature b :> a; // error
}
Fix this by replacing var with const:
class A { const feature a; }
class B :> A {
const feature b :> a; // ok
}
This can also be triggered by subsetting a constant feature with a
non-constant feature:
part def A { constant attribute c; }
part def B :> A {
attribute d :> c; // error
}
Instead, add constant to the subsetting feature:
part def A { constant attribute c; }
part def B :> A {
constant attribute d :> c; // ok
}