Skip to content
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

fix EqualsChecker for assignments #1845

Merged
merged 1 commit into from
Feb 13, 2018
Merged

Conversation

Egor18
Copy link
Contributor

@Egor18 Egor18 commented Feb 9, 2018

Hi! I have found a bug, in EqualsChecker class, and this PR is a possible fix.
The problem is that .equals method called on CtAssignment and CtOperatorAssignment (which extends CtAssignment) returns true, once rhs and lhs statements are the same. But this is not correct.
For example, statements x = 42 and x += 42 are not the same thing at all.
To fix that, I implemented visitCtAssignment method.
Also, I provided some tests (second assert fails, without this fix).

@monperrus monperrus merged commit dd71a65 into INRIA:master Feb 13, 2018
@monperrus
Copy link
Collaborator

Thanks a lot.

I wonder whether we don't have similar bugs due to covariance / contravariance in the equality visitor.

@Egor18 Egor18 deleted the fix_assign_equals branch February 15, 2018 18:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants