nicklockwood / SwiftFormat

A command-line tool and Xcode Extension for formatting Swift code
MIT License
7.63k stars 623 forks source link

`redundantParens` erroneously removes parentheses in closure definition #1674

Closed antiraum closed 2 months ago

antiraum commented 2 months ago

This bug was introduced in 0.53.6 and is still present in 0.53.7.

let processURL: (URL) async throws -> Void = { url in
}

get's reformatted to

let processURL: URL async throws -> Void = { url in
}

Thanks for SwiftFormat and looking into this!

noais commented 2 months ago

Same here: let formatTime: (String) -> Time? = supportsUTCDateFormat

tobihagemann commented 2 months ago

I guess everything has already been said, but another reference if needed, it happened here as well:

let localImportHandler: (Error?) -> Void = { error in

And now my CI build fails with:

single argument function types require parentheses

Edit: Sorry for the noise, didn't see the "fixed in develop" label.

nicklockwood commented 2 months ago

@antiraum fixed in 0.53.8