Conversation
- Fixes the handling of resolution of names of references to members inherited from the implied base type.
- Avoids possibility of improper resolution of other names when using semantic metadata.
|
I'm trying to test your example on Jupyter. Is there any way to evaluate KerML on Jupyter SysML kernel? |
No, the Jupyter deployment cannot parse KerML. I wrote the PR description poorly. The bug was originally identified in a SysML model. However, since the underlying cause was in the KerML Core implementation, the Xpect test for the resolution is a KerML test. The KerML model shown in the PR description is from the Xpect test. I have updated the PR description to make this clearer. |
|
Ed, thank you. I found one typo in your example in Line 17 ( was evaluated successfully with |
Oops. That was a manual change after I copied the validated text from the editor. I've fixed it now! |
This PR fixes a bug that could cause an incorrect name resolution when using semantic metadata.
Background
The following SysML model should parse, with
p1::aredefiningP::a:Previously, this worked in the Eclipse Xtext editor, but in Jupyter the model gave the errors:
In Jupyter, name resolution happens during top-down transformation of the model. During the transformation of
p1, the reference to the semantic metadataMmust be resolved in order to get the implied base type forp1. This name resolution begins in the scope ofp1, resultin in the redefined feature nameabeing resolved early, in order to check the (effective) name of the redefining feature. But, at this point, inheritance from the implied base type is blocked, in order to avoid circular resolution ofM. So the reference to a inp1resolves toQ::a.In Eclipse, the Xtext reconciler proxy resolution works bottom up, resolving the proxy for
Min the declaration ofmbefore processingmas semantic metadata during the transformation ofp1. Whenais resolved, this triggers the adding of the implied subsetting ofp1byP, so the reference to a resolves toP::a(as it should).Changes
ParsingTests_SemanticMetadata.kerml.xt. Since the underlying problem is in the KerML core, it is a KerML Xpect test similar to the above SysML model. Name resolution in Xpect is similar to Jupyter, so the following model had errors previously, but does not have errors after the change below is made.metadataFeature.getMetaclass()in the methodTypeAdapter::getBaseTypesin the loop over the owned metadata features of a typ ethat compute the implied base types from those metadata features that are semantic metadata. The call is added such that any proxy resolution (requiring name resolution) for the metaclass will happen before the computation of the base type.