Skip to content
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

Use owner stack to associate owners to methods #2025

Merged
merged 1 commit into from
May 9, 2024
Merged

Conversation

vinistock
Copy link
Member

Motivation

Closes #1338

Previous attempt #1264.

We cannot use a single owner value to keep track of method owners because there might be several levels of nesting. We need to use a stack.

On the original PR, the main source of discussion was that it was trying to get rid of @stack to have only an owner stack. Unfortunately, that would break aliases which need to remember the exact nesting in which they were found.

Thinking more about the problem, I think it should be fine to maintain two separate stacks. The only values that need to remember the exact nesting where they were discovered are unresolved aliases. Being forced to store the original nesting arrays on every namespace would be wasteful. Better to use two arrays and let them be garbage collected as soon as we're done.

Implementation

Changed @current_owner to be an @owner_stack instead.

Automated Tests

Added a test that reproduces the bug.

@vinistock vinistock added bugfix This PR will fix an existing bug server This pull request should be included in the server gem's release notes labels May 9, 2024
@vinistock vinistock self-assigned this May 9, 2024
@vinistock vinistock requested a review from a team as a code owner May 9, 2024 13:42
@vinistock vinistock requested review from andyw8 and st0012 May 9, 2024 13:42
@vinistock vinistock merged commit 894fd41 into main May 9, 2024
39 checks passed
@vinistock vinistock deleted the vs/use_owner_stack branch May 9, 2024 17:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix This PR will fix an existing bug server This pull request should be included in the server gem's release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

command click highlights incorrect method definition
2 participants