Closed juri closed 2 years ago
This also occurs for a function returning a dictionary, e.g.:
if let test = value()["hi"] {
print("hi")
}
produces "error: Expected { on line 1"
@juri @zacwest fixed in 0.49.2
Still running into this on 0.49.2
:
guard let row: Row = promotionSections[indexPath.section][indexPath.row] else { return UITableViewCell() }
produces
error: Expected { on line
@shkhaliq I'm not able to reproduce the error on 0.49.2 with a file containing just that line. Can you provide a standalone example that demonstrates the problem? Or perhaps something in your .swiftformat config is needed to reproduce it?
Okay how about you try this in an empty file. I can reproduce it then
public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
guard let row: Row = promotionSections[indexPath.section][indexPath.row] else { return UITableViewCell() }
let cell = tableView.dequeueReusable(RowTableViewCell.self, forIndexPath: indexPath)
cell.update(row: row)
return cell
}
@shkhaliq OK, I can reproduce with this example, thanks 👍
@shkhaliq this appears to be fixed in 0.49.3
@nicklockwood Yes thank you for the fix!
This is a valid Swift file:
Running SwiftFormat 0.49.1 on it with no configuration reports the following:
It looks like it requires that double subscript to trigger it, it didn't happen with a simple dict.
This worked with SwiftFormat 0.48.x, but seems to have broken with 0.49.