SwiftRewriter
SwiftRewriter copied to clipboard
Incorrect indentation of switch with pattern matching
Given:
enum Foo {
case P(x: Int)
}
class A {
func a() -> Bool {
return true
}
}
func foo() {
switch Foo.P(x: 1) {
case .P(1)
where
A()
.a():
print(1)
case .P(let 2)
where
A()
.a():
print(2)
case _:
print("other")
}
}
Output:
enum Foo {
case P(x: Int)
}
class A {
func a() -> Bool {
return true
}
}
func foo() {
switch Foo.P(x: 1) {
case .P(1)
where
A()
.a():
print(1)
case .P(let 2)
where
A()
.a():
print(2)
case _:
print("other")
}
}