Closed honghaoz closed 8 months ago
FYI @calda I've fixed this for now by just disabling the rule for switch statements containing conditional compilation logic. A proper fix would check for returns or assignments inside the conditional compilation blocks, but that seemed a little too complex and risky for a quick fix.
@honghaoz fixed in 0.52.10
Thank you! I think this is a reasonable strategy. As one example off the top of my head the organizeDeclarations
rule also doesn’t modify code within conditional complication blocks, since it adds complexity.
Hi, I encountered an issue with the
conditionalAssignment
rule (Swift 5.9)For example, for the following code:
After formatting, it changes to:
which won't compile anymore.
Reproducible on On Xcode 15.0.1 (Swift 5.9), SwiftFormat 0.52.9