Subsetting featuring types warning

Hi all,

I’m trying to create a model structure where I can merge some base part with the context of a subpart in a usage of that base part. See the following for an example:

package SubsettingExample {
    
    part def PartBase {
        attribute a;
        part subPart : SubPartBase;
    }

    part def SubPartBase {
        part subPartContext {
            attribute b;
        }
    }
    
    part mergedPart :> PartBase::subPart.subPartContext : PartBase {
        attribute :>> a = 1;
        attribute :>> b = 2;
    }
}

The behavior is correct, I’m able to redefine the attributes without a problem.
However, I’m getting a warning at line 14:24: “Subsetted feature must be accessible from the subsetting feature (use dot notation for nesting)”.

How can I fix this?

Greetings,
Jasper

Hi,

This happens because mergedPart is a package level feature without featuring types, while subPart - a nested feature with featuring type PartBase.

There is no general fix for this as it depends on the model and intent. One option is to make mergedPart a feature nested in a type conforming to PartBase, e.g.

    part def Outer :> PartBase {
        part mergedPart :> PartBase::subPart.subPartContext : PartBase {
            attribute :>> a = 1;
            attribute :>> b = 2;
        }
    }
1 Like