-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Ruby: Two fixes for private
methods
#10504
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
Conversation
b394408
to
61e9c6f
Compare
* end | ||
* end | ||
* ``` | ||
* |
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 is this distinction important? Both m
and nested
are instance methods of M
. The only difference is that nested
only exists after m
has been called at leas once.
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.
It was not clear to me whether such conditional methods (being conditional on other methods being called) should now be included. I thought it would be safer to not include them in this PR, and then we can reconsider later (in fact, I already have a PR lined up with some call graph tests for nested methods).
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.
True, but you are including conditional methods like:
if rails.version < 6
def x; end
end
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'm fine with excluding nested method for now. Just wanted to make sure it was for the right reason.
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.
True, but you are including conditional methods like
Indeed. Let's add all nested methods in a follow-up PR.
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.
Looks good to me. One question about "nested" methods,
ModuleBase::get(A)Method
did not work for methods directly annotated withprivate
.private
methods can be overridden.Commit-by-commit review is suggested.
I sampled a couple of new call graph edges for each project, and they all looked legit.