Skip to content

Incorrect indentation of for loop with case pattern matchΒ #25

@taku0

Description

@taku0

Given:

enum Foo {
    case P(x: Int)
}
class A {
    func a() -> Bool {
        return true
    }
}

func foo() {
    for
      case let .P(x) in [Foo.P(x: 1)]
      where
        A()
          .a() {
        print(x)
    }
    for
      case let .P(x) in [Foo.P(x: 1)]
      where
        A()
          .a() {
        print(x)
    }
}

Output:

enum Foo {
    case P(x: Int)
}
class A {
    func a() -> Bool {
        return true
    }
}

func foo() {
    for
    case let .P(x) in [Foo.P(x: 1)]
        where
        A()
            .a() {
            print(x)
        }
        for
        case let .P(x) in [Foo.P(x: 1)]
            where
            A()
                .a() {
                print(x)
            }
        }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions