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.
This addresses #532
I left a comment in the code, but the reason for this bug is that when we have a qualified call, like
Mix.compilers()
, the AST will look like this:Note that
:compilers
(ie the identifier) is a "naked" atom, ie it's not wrapped in a block, so it doesn't have metadata. The line and column information for the identifier lives in theouter_metadata
, while the dot position information lives in theinner_metadata
. This means that we can't know the range of the inner:.
call if we don't have the parent too.When navigating down such tree, the first child will be the
:.
call, then the arguments follow. If we useZ.rightmost
to get the last child, but the call doesn't have any arguments like in this case, then the only child we'll get is the:.
call.The code generating this patch was trying to generate a patch on this
:.
call, but since that call alone doesn't have enough information to generate a range to patch, it crashed. The solution is basically to check if we landed in such call and if so then work with the parent node.