Repository navigation
fix(references): a local GROUP's field reached as Group.Field - #869
Merged
msarson merged 1 commit intoNov 25, 2026
Merged
Conversation
Find All References on a field of a procedure-local GROUP without PRE() listed only the declaration from the declaration, and from a use site (Tally.Rows) every other X.Rows in the searched files instead of the group's own uses. The plain route matched dotted StructureField tokens only for field scope, and the member route treated the group as a class. A field of a GROUP, QUEUE, FILE or RECORD now matches Group.Field by the structure's label, and a use site answers from the field's declaration. A TYPE structure is left out: its fields are reached through instances. Tests: 6 new in ReferencesPrelessGroupField.test.ts, 3 fail without the fix. Server suite: 4625 passing, 3 pending. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Find All References on a field of a local GROUP reached as
Group.FieldWhat happened
A procedure declares a GROUP without PRE() and uses its fields through the group label:
Rows: only the declaration came back. None of theTally.Rowsuses were listed.RowsinTally.Rows: Go to Definition lands on the right line, but References missed the procedure's own uses and listed every otherX.Rowsin the searched files instead (OrderLines.Rows,Summary.Rows, ... in unrelated procedures and modules).Root cause
Two routes, each wrong in its own way.
Plain-symbol route (cursor on the declaration). A field of a procedure-local GROUP resolves with scope
local, notfield.findReferencesInFileonly matches the dottedStructureFieldform for field scope:With scope
localtheTally.Rowstoken fell through to the object-prefix branch, which compares the first segment (tally) with the search word (rows) and drops it.Member route (cursor on
Rowsafter the dot).provideMemberReferencesresolvesTally.Rowsto the right declaration throughDottedAccessResolver, then treatsTallyas a class: it builds a class family and scans for.Rowsbehind any receiver, so it lists unrelated groups and queues and missesTally.Rowsitself.The fix
findReferencesInFile: when the symbol is a field of a GROUP, QUEUE, FILE or RECORD and is not field-scoped, aStructureFieldtoken matches when its last segment is the field and the segment before it is that structure's label (Tally.Rows,Outer.Tally.Rows):The existing line-range restriction for local scope still applies, so a same-named field of another procedure's group is not listed.
provideMemberReferences: when the resolved member is a field of such a structure declared in the current document, answer from the field's declaration through the plain route, so a use site lists exactly what the declaration lists.A structure with the TYPE attribute is excluded (
structureFieldQualifier): its fields are reached through the variables declared with it (MyQ.NameforMyQ QUEUE(BaseQ)), never through its own label, so narrowing to the label would lose them.Testing
server/src/test/ReferencesPrelessGroupField.test.ts, 6 tests: from the field declaration, fromRowsin a use site, fromTallyin a use site, from the group label, from another procedure's same-named field, and aQUEUE,TYPEfield reached through an instance.QUEUE,TYPEtest guards against over-narrowing: an earlier draft without the TYPE check failed it.ReferencesProvider.Perf309.test.tscaught an extra token fetch per scanned file in an earlier draft; the declaration-file lookup is now lazy and only runs for a field of a GROUP/QUEUE/FILE/RECORD.Scope: deliberately left out
'text' & Group.Fieldis split by the tokenizer. TheReferenceVariablepattern/&\s*[A-Za-z_][A-Za-z0-9_]*/takes the concatenation operator, the space and the next name as one token (& Tally), so the.Fieldthat follows becomes a bareFieldtoken. In this PR those uses are still found from the field, by name, but the group label's References miss them. The same pattern makes References miss a plain variable after&(with a space) anywhere:MESSAGE('Rows: ' & Num)is not listed,MESSAGE('Rows: ' &Num)is. This is a tokenizer change with a much wider reach, so it is a separate issue.scopeType === 'field'branch is unchanged.QUEUE,TYPEfrom its own declaration returns nothing, before and after this change. Not touched here.🤖 Generated with Claude Code