Cross-file qualified references through a root Element short name fail to resolve (#778) - #786
Closed
tkanov wants to merge 1 commit into
Closed
Cross-file qualified references through a root Element short name fail to resolve (#778)#786tkanov wants to merge 1 commit into
tkanov wants to merge 1 commit into
Conversation
tkanov
marked this pull request as draft
August 10, 2026 10:41
tkanov
force-pushed
the
fix/short-name-global-scope
branch
from
August 10, 2026 10:59
efb2b59 to
f4801d2
Compare
tkanov
marked this pull request as ready for review
August 10, 2026 11:01
Member
|
Sorry, we cannot accept pull requests from outside our development team. We will take your issue (#778) into consideration (this is actually a known problem). If you would like to contribute the the Pilot Implementation, consider joining (or having your organization join) the OMG Systems Modeling Community. The Pilot Implementation is maintained by the Reference Implementation Working Group of the SMC. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #778. A qualified name whose first segment is the short name of a root Element does not resolve across resources:
part x : P::Foo;fails wherepart x : Alpha::Foo;succeeds, andprivate import P::*;fails likewise, although short names resolve in every same-resource position.Cause.
KerMLQualifiedNameProviderexportsdeclaredName-based names only, so a root Element is never indexed under itsdeclaredShortName– andKerMLGlobalScope.getSingleElementresolves the first segment of a cross-resource qualified name through that index, before the short-name-awareKerMLScopeis reached.Changes
KerMLResourceDescriptionStrategyexports root Elements under their escapeddeclaredShortName. Nested Elements are unaffected, sinceKerMLScopealready handles those.<short-name>) and consulted byKerMLGlobalScope.getRootElementonly after adeclaredNamelookup misses, so a declared name takes precedence structurally rather than by index order. Without this,package <ScalarValues> MyPackagein one resource madeScalarValues::Realunresolvable in another.bindIDefaultResourceDescriptionStrategyinKerMLRuntimeModule,SysMLRuntimeModule,KerMLxRuntimeModuleandSysMLxRuntimeModule. Also exportedorg.omg.kerml.xtext.resource.ShortNameScopeTest, 7 cases. The cross-resource short-name cases fail before change 1. The three collision cases fail before change 2.org.omg.sysml.interactive.tests(215),org.omg.kerml.xpect.tests(963) andorg.omg.sysml.xpect.tests(308) all pass.Notes
This applies to every root Element with a short name, not only Packages – a root
part def <F> Foo;now resolves asF– consistent with a Namespace giving its members bothmemberNameandmemberShortName.Where a short name and a declared name collide, the declared name wins and the short name is unreachable as a first segment. That cannot break a reference that resolves today, but it is a semantics call, so I am happy to report the collision as an error instead. Related: the
declaredName-only index looks deliberate (ST6RI-628), so a check against the original intent may be warranted.Also included, unrelated and latent:
KerMLScope.qualifiedNameConverteris@Injected but everyKerMLScopeis constructed withnew, so it is always null andgetElement(String)would fail. It now comes from the injectedKerMLScopeProvider. Happy to split out.