Systems-Modeling / SysML-v2-Pilot-Implementation

Proof-of-concept pilot implementation of the SysML v2 textual notation and visualization
GNU Lesser General Public License v3.0
114 stars 23 forks source link

ST6RI-749 Bindings with the standard library metadata causes a warning only in Jupyter environment #551

Closed seidewitz closed 3 months ago

seidewitz commented 3 months ago

After the 2024-02 release, bindings of enumeration features of metadata usages of metadata definitions from library models, such as

part p {
    @ModelingMetadata::StatusInfo { 
        status = ModelingMetadata::StatusKind::tbd; // WARNING
    }
}

began causing "Bound features should have conforming types" warnings in the Jupyter environment. This did not happen in the Eclipse editor.

These warnings were caused by the implicit typing of the enumerated value not being properly set to its containing enumeration definition. The typing was only being established when a full transformation was done on the enumerated value declaration. In the Eclipse environment, a full transformation is done on the entire contents of a library model resource when it is read into memory. This is not the case, however, when library resources are preloaded into the Jupyter kernel for SysML, which is why the warnings on happened in the Jupyter environment. There was a change to the implementation of the typing check in 2024-02, such that the check failed if a feature had no types (which should never be the case), which is why the warnings did not happen before 2024-02.

The implicit typing of enumerated values is actually a special case of the general rules for implicit typing of variant features of variations (enumeration definitions are kinds of variation definitions). This PR moves the adding of variation typing into the implicit general type computation for usages, so that it is included in the "on demand" computation of implicit generalization during name resolution, which eliminates the spurious warnings.