Closed rastersize closed 6 years ago
The issue can be worked around in two ways. Neither of the following examples trigger the bug:
let foo: GenericType<(UIViewController) -> Void> = .init()
or
typealias SomeClosure = (UIViewController) -> Void
let foo = GenericType<SomeClosure>()
I went with the latter since it seems cleaner to me. Also SwiftFormat gets tripped up by the problem as well as the first workaround.
Also happens in situations where a generic parameter itself has a generic parameter:
let foo = Foo<Bar<T>, Baz>()
// is autocorrected to
let foo = Foo<Bar<T>, Baz > ()
There's still an issue with generic parameters, if they're placed on different lines. This:
let something = Something<GenericParameter1,
GenericParameter2>()
Becomes this:
let something = Something < GenericParameter1,
GenericParameter2 > ()
Would you please open a separate issue for that, @lazarevzubov? Herein, it will probably get lost.
Would you please open a separate issue for that, @lazarevzubov? Herein, it will probably get lost.
Sure, done: https://github.com/realm/SwiftLint/issues/3960
New Issue Checklist
Bug Report
The
operator_usage_whitespace
rule matches the trailing>
when specializing a generic type and initializing it at the same time.Environment
swiftlint version
to be sure)?xcode-select -p
)?echo "internal let foo = GenericType<(UIViewController) -> Void>()" | swiftlint lint --no-cache --use-stdin --enable-all-rules