Skip to content

fix(xtext): count selector fragment siblings the way they are resolved - #1585

Open
joaodinissf wants to merge 1 commit into
masterfrom
test-selector-fragment-case
Open

joaodinissf wants to merge 1 commit into
masterfrom
test-selector-fragment-case

Conversation

@joaodinissf

@joaodinissf joaodinissf commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator

AbstractSelectorFragmentProvider counted earlier siblings with the same selector value using equals() when computing a fragment, but getEObjectFromSegment matches them ignoring case unless the class is an ICaseSensitiveNamedElement. For a case-insensitive class with siblings foo and FOO, the fragment of FOO was …(…='FOO')#0, which resolved to foo. References, index entries and navigation to FOO silently landed on foo.

Both sides now use one matches helper.

Scope

  • Only languages whose .export declares a non-unique uri-fragment = attribute(...) on a type that isn't an ICaseSensitiveNamedElement, with siblings whose values differ only in case (for example overloads in a case-insensitive language). DDK's own languages don't use uri-fragment.
  • The only fragments that change are ones that previously resolved to the wrong object, so no correct stored fragment changes. Rebuilding affected resources refreshes the stale ones.
  • The unique form is unchanged.

Tests. These are the first case-sensitivity tests in AbstractSelectorFragmentProviderTest, using a dynamic EMF model:

  • a case-sensitive class distinguishes foo and FOO;
  • a case-insensitive class resolves 'FOO' to foo;
  • case-insensitive siblings foo and FOO each round-trip to themselves. This fails without the fix.

Follow-up to #1584.

🤖 Generated with Claude Code

computeSelectorFragmentSegment counted earlier siblings with the same
selector value using equals(), while getEObjectFromSegment matches them
ignoring case unless the class is an ICaseSensitiveNamedElement. For a
case-insensitive class with siblings "foo" and "FOO", the fragment of
"FOO" got index 0 and resolved to "foo".

Both sides now use the same comparison. Fragments change only for
case-insensitive siblings whose selector values differ only in case.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@joaodinissf
joaodinissf marked this pull request as ready for review October 29, 2026 13:34
@joaodinissf
joaodinissf enabled auto-merge October 29, 2026 13:43

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant