Closed ski-u closed 7 months ago
Same issue, shows errors for this line:
let wrapCompletion: (NetworkResponse<SuccessType, ErrorType>) -> () = { parameters in
and removes parentheses around NetworkResponse.
describe("getAlbums") {
typealias PhotoEnumerationHandler = PhotoFetchResultEnumeration -> Void
typealias PhotoCollectionEnumerationHandler = (PhotoCollection) -> Void
Removed the parens on the first typealias, but not the second. But if I extract the declaration of typealiases to the top of the file, swiftformat doesn't touch the parens.
I think the common thread to all of these bugs is that the parens are the first ones inside a closure. I've pushed a fix to the develop branch.
@ski-u fixed in 0.53.7
@nicklockwood The issue still persists for this case:
describe("getAlbums") {
typealias PhotoCollectionEnumerationHandler = (PhotoCollection) -> Void
typealias PhotoEnumerationHandler = (PhotoFetchResultEnumeration) -> Void
$ ./bin/swiftformat
Swiftformat version: 0.53.7
-- rules applied: redundantParens
SwiftFormat for Xcode
would just remove the parens on the PhotoCollection
causing a compile error:
Replace 'PhotoCollection' with '(PhotoCollection)'
Forced to use anonymous parameter workaround, but I would rather not :(
@dumoko fixed in 0.53.8
Hi, thank you for working hard at
SwiftFormat
! I tried a new version (v0.53.6) and found one unexpected behavior aboutredundantParens
so I filed this issue ✏️Reproduce
swiftformat
command to a fix file containing the following codefunc someOperation() async throws { let request = URLRequest(url: .init(string: "https://example.com")!) Task { async let dataTask1: Void = someTask(request) // Unexpected changes will occur here async let dataTask2: Void = someTask(request) } }
func someTask(_ request: URLRequest) async throws { URLSession.shared.dataTask(with: request) }
ℹ️ I used this command
My environment