Skip to content

Comments

ST6RI-847 TypeUtil.isCompatibleWith does not match specification#658

Merged
seidewitz merged 1 commit intomasterfrom
ST6RI-847
Jun 6, 2025
Merged

ST6RI-847 TypeUtil.isCompatibleWith does not match specification#658
seidewitz merged 1 commit intomasterfrom
ST6RI-847

Conversation

@seidewitz
Copy link
Member

@seidewitz seidewitz commented Jun 4, 2025

This PR corrects a non-conformance of the Pilot Implementation with the KerML Specification on the computation of the Feature::isCompatibleWith operation.

The isCompatibleWith operation allows a feature to be considered "compatible with" another feature, even if the first feature is not a specialization of the second. This is necessary to allow the implied featuring types of variable features to be considered compatible in certain cases. But, according to the specification, two features can only be compatible in this way if they both have no nested features. Previously, the Pilot Implementation allowed compatibility if at least one of the features had no nested features, but didn't require both to have no features. This PR changes the implementation to conform to the specification.

The non-conformance in the implementation was not actually accidental, however. As previously implemented, the following model was considered valid:

class A {
    :>> snapshots {
        feature s;
    }
    var feature x :> snapshots::s;
}

With the change made in this PR, the implied featuring type of the variable feature x is no longer considered compatible with snapshots, because snapshots has the nested feature s, so the subsetting violates the validateSubsettingFeaturingTypes constraint. The workaround is to use the feature chain snapshots.s, rather than the qualified name snapshots::s.

The intent had been to propose revising the specification of isCompatibleWith to be similar to the implementation of isCompatibleWith that allowed models such as the example above. This did not happen, though, and, since there is generally an easy workaround for the missing capability, it is better for the Pilot Implementation to be conformant to the specification as adopted.

@seidewitz seidewitz added this to the 2025-06 milestone Jun 4, 2025
@seidewitz seidewitz self-assigned this Jun 4, 2025
@seidewitz seidewitz merged commit d24ef45 into master Jun 6, 2025
1 of 4 checks passed
@seidewitz seidewitz added the bug Something isn't working label Jun 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants