-
-
Notifications
You must be signed in to change notification settings - Fork 55
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
ProcessedSource#ast_with_comments
doesn't differentiate between identical nodes
#179
Comments
Indeed, this is surprising 😅 This was noted in whitequark/parser#184: "Note that {associate} produces unexpected result for nodes which are equal but have distinct locations; comments for these nodes are merged." The proposed fix was IMO, a better method than either of them would be I believe that we could modify our |
As I expected, tests pass on |
Released 1.5.0... |
Thanks for the quick work @marcandre! 🎉 |
This spec passes but is strange behaviour:
Here is the actual hash created:
Because there are two
s(:send, nil, :do_a)
nodes, both comments are associated with the same node in the hash, and then when this is used in rubocop (for instanceCommentsHelp.begin_pos_with_comment
), it returns potentially the wrong comment node.I don't know that there is a good way to fix this necessarily without changing how the keys are constructed; this might also not be a RuboCop::AST bug directly either.
The text was updated successfully, but these errors were encountered: