You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
enumTheEnum{case foo(Int)}func f(e:TheEnum, bar:String){
switch e {caselet.foo(bar):print(bar)}}
This code does not change after being formatted. However, the argument bar is not used inside the function f, so it should be func f(e: TheEnum, bar _: String) (since the unusedArguments option is enabled by default.) It seems that functions with switch-case-let are not formatted properly.
Just for your information, SwiftFormat works fine with functions with if-case-let or guard-case-let.
// BEFORE FORMATTEDenumTheEnum{case foo(Int)}func f(e:TheEnum, bar:String){
if case let.foo(bar)= e {print(bar)}}func g(e:TheEnum, bar:String){
guard case let.foo(bar)= e else{return}print(bar)}
// AFTER FORMATTEDenumTheEnum{case foo(Int)}func f(e:TheEnum, bar _:String){
if case let.foo(bar)= e {print(bar)}}func g(e:TheEnum, bar _:String){
guard case let.foo(bar)= e else{return}print(bar)}
Environment
$ swiftformat --version0.54.5
The text was updated successfully, but these errors were encountered:
I have a code like this:
This code does not change after being formatted. However, the argument
bar
is not used inside the functionf
, so it should befunc f(e: TheEnum, bar _: String)
(since theunusedArguments
option is enabled by default.) It seems that functions with switch-case-let are not formatted properly.Just for your information, SwiftFormat works fine with functions with if-case-let or guard-case-let.
Environment
The text was updated successfully, but these errors were encountered: