Weird method location shouldn't match unknown location #2244
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.
Methods that don't have a source location (e.g., C methods, or methods
created via metaprogramming or even
alias_method) are not reasonablepossible matching methods for a "weird method" we need to locate.
In this case
renamed_method_source_locationcan also returnnilifthe actual code in question is a bare script (i.e., no methods). If that script
is loaded via
evalthen we'll end up in the weird method path in the firstplace, but no method matching can be found, and if a no-source-location
method exists, we'll return that.
Down the line that's particularly painful because the source loading thinks
it's a C method, but it can actually be from metaprogramming (and
alias_method!),and then
Pry::Method#pry_doc_inforaises an error, andwheramibreaks eventhough we already have valid
__FILE__and__LINE__values.