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

Add references support for instance variables #2787

Merged
merged 2 commits into from
Jan 13, 2025

Conversation

monkeyWzr
Copy link
Contributor

Motivation

Closes #2641

Implementation

Add references support for instance variables.

Manual Tests

Kapture 2024-10-27 at 21 57 23

@monkeyWzr
Copy link
Contributor Author

I have signed the CLA!

@monkeyWzr monkeyWzr marked this pull request as ready for review October 30, 2024 13:16
@monkeyWzr monkeyWzr requested a review from a team as a code owner October 30, 2024 13:16
Copy link
Contributor

This pull request is being marked as stale because there was no activity in the last 2 months

@github-actions github-actions bot added the Stale label Dec 30, 2024
@vinistock vinistock added enhancement New feature or request server This pull request should be included in the server gem's release notes and removed Stale labels Jan 7, 2025
Copy link
Member

@vinistock vinistock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks and we can ship. For some reason though, CI seems to be stuck and won't run. I also can't seem to trigger it manually for whatever reason. Could you please try rebasing this branch to trigger CI again?

Regarding the discussion in the issue, ideally we would use our type inferrer to narrow instance variable references only to the ones that actually refer to the same one. Would you be interested in tackling that in another PR? If not, I'll create an issue for it.

We'd essentially need to require the type inferrer to be passed to the references finder and then we need to ensure that the receiver type of the instance variables match the one the user clicked on.

@monkeyWzr monkeyWzr force-pushed the instance_variable_instances branch from 1d9d2cb to b8506f6 Compare January 10, 2025 05:42
@monkeyWzr
Copy link
Contributor Author

@vinistock

Regarding the discussion in the issue, ideally we would use our type inferrer to narrow instance variable references only to the ones that actually refer to the same one. Would you be interested in tackling that in another PR? If not, I'll create an issue for it.

Yeah I'd love to give it a shot!

@vinistock
Copy link
Member

Yeah I'd love to give it a shot!

Awesome! It should be something along these lines:

  1. We need the instance variable target to remember what type it belongs to, so that we can compare with other occurrences
  2. We need to pass the type inferrer instance all the way to the reference finder, so that it can be used for instance variables
  3. We can only consider it a valid reference if both name and receiver type match between the target and the occurrence

Don't hesitate to reach out if you have doubts!

@vinistock vinistock merged commit 2e099da into Shopify:main Jan 13, 2025
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request 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.

Add references support for instance variables
2 participants