Consider this example code.
let startVariableWithLongName = 21
let endVariableWithLongName = 42
let offsetVariableWithLongNameToMakeLinesSuperLong = 25
let myOpenEndedRangeThatHasAReallyLongName = (startVariableWithLongName + offsetVariableWithLongNameToMakeLinesSuperLong)..<(endVariableWithLongName + offsetVariableWithLongNameToMakeLinesSuperLong)
The final line is about 200 characters, which swift format attempts to fix to 100 by default (I believe).
Running swift format using Swift 6.2.3 results in the following:
let startVariableWithLongName = 21
let endVariableWithLongName = 42
let offsetVariableWithLongNameToMakeLinesSuperLong = 25
let myOpenEndedRangeThatHasAReallyLongName =
(startVariableWithLongName + offsetVariableWithLongNameToMakeLinesSuperLong)
..<(endVariableWithLongName + offsetVariableWithLongNameToMakeLinesSuperLong)
which results in an error, since ..< is now treated as a prefix operator rather than the infix it should be.
This example is contrived, but this is quite realistic when code is deeply nested with shorter variable names.
Consider this example code.
The final line is about 200 characters, which swift format attempts to fix to 100 by default (I believe).
Running
swift formatusing Swift 6.2.3 results in the following:which results in an error, since
..<is now treated as a prefix operator rather than the infix it should be.This example is contrived, but this is quite realistic when code is deeply nested with shorter variable names.