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.
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
Gems: Fix gem RBI compilation for aliased methods where the original method has a sig #2051
base: main
Are you sure you want to change the base?
Gems: Fix gem RBI compilation for aliased methods where the original method has a sig #2051
Changes from all commits
cd6ee9c
e259339
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Why was this moved after the checks on line 92? Does it matter for aliased methods?
I think it'll be a bit cleaner if it was done in theelsif
instead.We could remove the
if signature
completely and have this assignment after theelsif
.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.
I agree its a bit complex but wasn't sure if it would be appropriate to refactor it to make it more readable. Would that be appropriate here?
If you move this to line 91, signature could be nil and you get a crash
method = T.let(signature.method, UnboundMethod)
If you leave
if signature
but move it to line 91, you get duplicate rbi defs for the original method, and the alias method doesn't get the rbi def.The checks would be done on the original method name and not the alias method name if we replace the method and assign method_name before the checks, because line 97 sets it to the original method. I think the problem here is that the meaning of method is ambiguous between the original method and the alias method - that should at least be fixed if nothing else, but let me know your thoughts
otherwise I think it is correct as is but not as readable as it could be
I'll update the test to ensure that attempting to alias to a name like
__t_props_generated_foo
will not produce rbi for that method as wellThere 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.
Sorry I wasn't clear in my original message, I wanted to get rid of duplicate
method = T.let(signature.method, UnboundMethod) if signature
in case of no alias methods (lines 81 and 97), but yes I see the need now.It might be good enough to just have a comment on line 97 mentioning that it's only for the alias case and that after running checks on the original method we are setting it to the aliased method for generation. But feel free to refactor if there are opportunities.
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.
ok, will get to this soon