nicklockwood / SwiftFormat

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

method which name is underscore cannot use. #977

Closed soranoba closed 3 years ago

soranoba commented 3 years ago

Run swiftformat with no config makes the following changes, but these changes fail to compile.

@@ -58,7 +58,7 @@ open class Store<State> {
     /// Returns the BindingTarget for the keyPath.
     /// - Parameter keyPath: KeyPath to bind.
     /// - Returns: The BindingTarget.
-    open func `_`<Value>(_ keyPath: KeyPath<State, Value>) -> BindingTarget<State, Value> {
+    open func _<Value>(_ keyPath: KeyPath<State, Value>) -> BindingTarget<State, Value> {
         return BindingTarget(store: self, keyPath: keyPath)
     }
nicklockwood commented 3 years ago

@soranoba thanks for reporting this. It's caused by the redundantBackticks rule, so you can just disable that with --disable redundantBackticks as a workaround for now.

soranoba commented 3 years ago

I see. Thanks many.

nicklockwood commented 3 years ago

@soranoba fixed in 0.48.10