★ wanayoo — archive 1999 https://github.com/code-cracker/code-cracker/issues/798Nouvelle recherche | Portail wanayoo
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

BUG: CC0014 converts if y then x += 1 else x =1 to x +=(if(y, 1, 1) #798

Closed
kwhitefoot opened this issue May 30, 2016 · 4 comments
Closed

BUG: CC0014 converts if y then x += 1 else x =1 to x +=(if(y, 1, 1) #798

kwhitefoot opened this issue May 30, 2016 · 4 comments
Projects
Milestone

Comments

@kwhitefoot
Copy link

@kwhitefoot kwhitefoot commented May 30, 2016 •

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.

Dim s As String
If True Then
    s += "a"
Else
    s = "b"
End If

Current output after fix applied:

s += If(True, "a", "b")

Fix should go to branch v1.0.x.

@bergarces is working on it.

@giggio
Copy link
Member

@giggio giggio commented Aug 7, 2016

Bug confirmed. I have made the example simpler and added a comment about the branch.

@giggio giggio added this to the 1.0.1 milestone Aug 7, 2016
@giggio giggio changed the title CC0014 converts if y then x += 1 else x =1 to x +=(if(y, 1, 1) BUG: CC0014 converts if y then x += 1 else x =1 to x +=(if(y, 1, 1) Sep 6, 2016
@giggio giggio modified the milestones: 1.0.1, 1.0.2 Sep 6, 2016
@bergarces
Copy link
Contributor

@bergarces bergarces commented Dec 13, 2016

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?

@giggio
Copy link
Member

@giggio giggio commented Jan 7, 2017

@bergarces yes, go ahead, send the PR! :)

@bergarces bergarces mentioned this issue Jan 8, 2017
giggio added a commit that referenced this issue Jan 8, 2017
…gnostics

Also added 2 new tests
Fixes #798
@giggio giggio added 3 - Done and removed 2 - Working labels Jan 8, 2017
@giggio
Copy link
Member

@giggio giggio commented Jan 8, 2017

Closed on #861

@giggio giggio closed this Jan 8, 2017
@giggio giggio moved this from Ready to Done in CodeCracker Jun 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.