Formatting
struct Foo {
let `defer`: Bool
}
let foo: KeyPath<Foo, Bool> = \.`defer`
results in
struct Foo {
let `defer`: Bool
}
let foo: KeyPath<Foo, Bool> = \.defer // 馃洃 error: consecutive statements on a line must be separated by ';'
My guess - Keywords are not checked in KeyPaths in the redundantBackticks rule?
Apparently only checks on the shorthand notation are needed. The following compiles fine:
struct Foo {
let `defer`: Bool
}
let foo: KeyPath<Foo, Bool> = \Foo.defer
This has really low priority to me, and I'd be fine inserting a comment for the linter there.
Thought it still might be worth the report
@PabloSichert thanks for reporting this. Even obscure/low-pri bugs are worth reporting, as they might be indicative of a larger issue 馃憤
@PabloSichert fixed in 0.37.3
Just built swiftformat from source and can confirm it's fixed (doesn't seem to be released on brew yet).
Thank you!
Small update:
let foo: KeyPath<Foo, Bool> = \.defer
seems to be valid syntax as of Swift 5.0.
@pablosichert thanks for the update - I'll add a version-specific check.
This check has been added in 0.41.0