mutagen
mutagen copied to clipboard
Mutation: Swap similar operators
One option would to swap + and - or * and %.
Also similar for x += 1 and x -=1 etc
However this will probably trigger under/overflow issues.
Under-/overflow issues are the least of my worries: There may be types that implement AddAssign, but not SubAssign (for example String) and the other traits are the same.
We may be able to do this by rebuilding most of typeck, but I think this is an advanced feature...
This can be done with specialization so we let typeck infer the correct code for us.