nicklockwood / SwiftFormat

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

Incorrect removal of parentheses with ranges #968

Closed tgrapperon closed 3 years ago

tgrapperon commented 3 years ago

Hello! I've spotted a configuration where SwiftFormat removes parentheses and make the code not compilable:

A(
  first: 1...(.greatestFiniteMagnitude),
  second: 1...(.greatestFiniteMagnitude)
)

is formatted as

A(
  first: 1....greatestFiniteMagnitude,
  second: 1....greatestFiniteMagnitude
)

It seems to work as expected when only one range is involved:

A(
  first: 1...(.greatestFiniteMagnitude)
)

is formatted as

A(
  first: 1 ... .greatestFiniteMagnitude
)

Thanks!

nicklockwood commented 3 years ago

@tgrapperon fixed in 0.48.7