CC0118 Remove to string only if it is save to do#939
Merged
giggio merged 9 commits intocode-cracker:masterfrom Jun 24, 2017
Merged
CC0118 Remove to string only if it is save to do#939giggio merged 9 commits intocode-cracker:masterfrom
giggio merged 9 commits intocode-cracker:masterfrom
Conversation
Contributor
Author
|
Currently the build fails because I have used some C#7 features:
Should I remove those features or can you upgrade AppVeyor? |
Member
|
The problem was in psake. I wrote a workaround now on 8f48dfe. More info: psake/psake#201 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #866.
I implemented option 2 as requested. This fix now looks up the types of both sides of the plus operator and tries removes those candidates, that might break things.
It turned out, that some of the checks in
CheckAddOperationOverloadsOfTypesare not needed (After the second check every other check returnsfalse). Essentially right now the removal of "ToString" is only save if either the underlying type is a string (as in1 + "a".ToString()) or the type on the other side of the plus operator is a string (as in "a" + 1.ToString()). I kept all the other checks for future enhancements to make clear that there are several cases to consider. Further I added lots of unit tests to cover these cases. The idea is thatCheckAddOperationOverloadsOfTypescan easily be expanded in the future to support more cases without breaking anything. Those redundant checks are also very cheap and are essentially just simple comparisons.I also had some troubles with the merging (started of the master branch, tried to re-base my changes on the V1.0.x branch, discovered that you removed this analyzer there, went back to master). So I'm sorry for the complicated commits in this pull request.