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_feature of a Subsetting has is_constant = true and the subsetting_feature has is_variable = true, then the subsetting_feature must have is_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
}