Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upBUG: CC0014 converts if y then x += 1 else x =1 to x +=(if(y, 1, 1) #798
Comments
|
Bug confirmed. I have made the example simpler and added a comment about the branch. |
|
Hi. Sorry I didn't post before, but I saw this bug and I was checking if I could fix it myself before asking, as I wasn't sure I'd be able to. I noticed though that the example works if the += operator is on the Else, but it doesn't if it's in the If, so I've just amended it in a way that it should work with both. I've added some extra tests and it seems to pass all of them Is it ok if I do a PR? |
|
@bergarces yes, go ahead, send the PR! :) |
…gnostics Also added 2 new tests Fixes #798
|
Closed on #861 |
Bug
In cases where one branch of an if increments a variable and the other assigns a value to it then CC0014 should not offer a fix.
Current output after fix applied:
Fix should go to branch
v1.0.x.@bergarces is working on it.