Closed bpdabrowski closed 8 months ago
@calda if you could take a look at this one it would be appreciated! (Don't worry if not - I've no reason to think it's your code that's at fault, I just can't face it right now 😅)
This is a bug in the conditionalBranches(at:)
/ switchStatementBranches(at:)
code I had written. Will post a fix, thanks for tagging me.
Here's a fix: https://github.com/nicklockwood/SwiftFormat/pull/1577
This actually turned out to be an issue in the tokenizer rather than in switchStatementBranches
itself.
@bpdabrowski fixed in 0.52.9
Hello! My team and I were seeing the below issue in our codebase when using multiple
where
clauses in aswitch
statement. TheredundantReturn
rule seems to skip over and not remove thereturn
statements when there are multiplewhere
clauses like the failing example below. When there is only onewhere
clause, thereturn
statement is removed properly as seen in the succeeding example.I added a couple of tests below based off of the tests in RulesTests+Redundancy to hopefully illustrate the issue a bit better. Thanks for your help 😃
The below test is an example showing the failing
where
clause that we seeing in our codebase.Failing test output:
The below test shows a succeeding test with a single
where
clause where it properly removes thereturn
statement from all cases. Wondering if its possible to have this functionality for multiplewhere
clauses.