-
Couldn't load subscription status.
- Fork 223
Fix infinite recursion in constant alias resolution #3783
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix infinite recursion in constant alias resolution #3783
Conversation
How to use the Graphite Merge QueueAdd the label graphite-merge to this PR to add it to the merge queue. You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR! And good catch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the PR!
Motivation
Closes #3782
Fixes a
SystemStackErrorthat occurred when resolving certain constant aliases. When a nested module defines a constant alias referencing another constant of the same short name in an outer namespace (for example,B = B::CinsideA::D), the Ruby LSP indexer entered infinite recursion becauseseen_nameswas not propagated tofollow_aliased_namespace.Implementation
Pass
seen_namesfromdirect_or_aliased_constantintofollow_aliased_namespaceto enable proper cycle detection.Automated Tests
Added a regression test
test_resolving_self_referential_constant_aliascovering theB = B::Ccase.Manual Tests
test.rb:4.Expected: No crash. B correctly resolves to A::B::C.