nicklockwood / SwiftFormat

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

SwiftFormat error on operator syntax #1205

Closed alanzeino closed 2 years ago

alanzeino commented 2 years ago

Using the latest version of SwiftFormat (0.49.11), this code:

private extension FooOperator {
    var op: ((Double, Double) -> Double)? {
        switch self {
        case .unknown:
            return nil
        case .add:
            return (+)
        case .subtract:
            return (-)
        case .multiply:
            return (*)
        case .divide:
            return (/)
        }
    }
}

results in an error parsing the return (/):

error: Unexpected end of file at 14:23 in /Users/alanz/Downloads/FooOperator.swift.
nicklockwood commented 2 years ago

@alanzeino fixed in 0.49.12