Report const cycle diagnostic per node to match class convention#1681
Merged
TwitchBronBron merged 1 commit intomasterfrom Apr 27, 2026
Merged
Report const cycle diagnostic per node to match class convention#1681TwitchBronBron merged 1 commit intomasterfrom
TwitchBronBron merged 1 commit intomasterfrom
Conversation
Drop the per-cycle dedup so an N-cycle of consts produces N diagnostics, each rooted at a different cycle member with the chain rotated to start at that member. This matches the existing class-hierarchy circular reference detection (see ClassValidator.detectCircularReferences and BrsFile.Class.spec.ts), so users see a uniform diagnostic shape across the two cycle types.
TwitchBronBron
approved these changes
Apr 27, 2026
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.
Summary
Follow-up to #1680. The const cycle diagnostic added there reported each cycle once (deduped via the lexicographically-smallest fullName). The class hierarchy diagnostic in ClassValidator.detectCircularReferences reports an N-cycle as N diagnostics — one rooted at each member, with the chain rotated so the diagnostic's class is at the head. See BrsFile.Class.spec.ts:1215-1217 for the existing 3-cycle assertion.
This PR drops the dedup so consts emit the same shape, giving users a consistent diagnostic experience across the two cycle types.
Changes
ScopeValidator.detectCircularConstReferences: removed thereportedCycleStartsandfullyValidatedsets. Each const starts a fresh DFS; cycles are reported on every member with the chain rotated.Test plan
npx mocha— 2633/2633 pass, 0 regressionsnpx eslintclean on touched files🤖 Generated with Claude Code