muter
muter copied to clipboard
New mutation: swap true and false
trafficstars
Code like this:
foo = true // before
foo = false // after
Here’s a case where this could be better than just deleting lines with only side effects: you set the value to true, and true is the default, so removing the line does nothing, but negating the line does.
It is also useful for initializers and method parameters:
let x = foo(bar: true) // before
let x = foo(bar: false) // after
Thanks for this @ZevEisenberg! We'll prioritize this once we start adding new mutation operators