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
Comment.associate "merging" comments for identical nodes #184
Comments
Wow. That was a really dumb decision on my side. Indeed #associate is broken. |
@bbatsov @yujinakayama @yorickpeterse have you bumped into this bug? (How could you possibly have not?!) What do you think is the best course of action here? On a second thought it looks like |
@whitequark Not that I know of. In my case I only use comments for method definitions where this problem is probably less/not likely to occur. Changing the workings of |
No, they will not if I implement this change, which is why I am asking. |
I concur that the current behaviour has to be changed. The impact to RuboCop's codebase should be minimal. P.S. Believe it or not I've never noticed this so far (which of course means our tests could have been better). |
On reflection, I think that:
|
@whitequark To give some context, I depend on separate instances being considered equal in tests like this: https://github.com/YorickPeterse/oga/blob/f94461a9cadd3858bbf2bc5ee39484b865a5af96/spec/oga/xpath/parser/calls_spec.rb#L6 If two separate instances were no longer the same I'd have to fix a few thousand specifications spread across different projects. |
No, that's |
Ah ok, I thought it would apply to |
While I cannot no how everyone is using
Leaving the broken Perhaps we should think harder about this, but in the end I'm fine with whatever solution you'd prefer. /cc @jonas054 |
For me the current definition of If they where redefined to work on the objects identity my use value-object use case in mutant would break. I could fix this via using a Hash with custom (external It all boils down to what semantics
I do no think the root cause here is the definition of |
Which might happen in 5 years...
Thinking more about the problem I'm also inclined to believe that probably we shouldn't change anything in AST. Depending of the usage the current definitions can viewed as either good or bad and changing them won't really change this. |
I agree on ast. Let's figure out what to do with associate... |
Hi everyone and thank you VM for your help. |
That's a hard one. I can't think of a solution that is both elegant and won't break anything in the process. |
@yorickpeterse @bbatsov Please see the updated API in the master branch. Please also test and tell if it causes any trouble for you. |
cc @JoshCheek also |
@whitequark Using the current master branch results in 263 failures out of 490 examples, current stable version of parser passes just fine. I'm getting a huge amount of errors such as What do I have to change here to make things work again? |
@yorickpeterse After latest master commit should work out of the box. |
All my tests pass. |
@whitequark Thanks, all tests pass again using the latest master commit. |
Hi and thanks for Parser, it works great!
I seem to have a problem with the comments "associate" method. For example the code below:
will give me the following mapping:
So it looks like both calls to "f" have 2 lines of comment instead of 1 line each.
The text was updated successfully, but these errors were encountered: