swiftlang/swift-syntax

`BasicFormat` cannot indent closure body in tuple

Opened this issue · 1 comments

Description

BasicFormat cannot indent the closure body when it's nested in a LabeledExprSyntax.

Steps to Reproduce

let builder = ExprSyntax(
  """
  .init(
      name: {
      if let name {
          return name
      } else {
          return "John"
      }
      }()
  )
  """
)
assertBuildResult(
  builder,
  """
  .init(
      name: {
          if let name {
              return name
          } else {
              return "John"
          }
      }()
  )
  """
)

outputs:

Actual output (+) differed from expected output (-):
 .init(
     name: {
–        if let name {
–            return name
–        } else {
–            return "John"
–        }
+    if let name {
+        return name
+    } else {
+        return "John"
+    }
     }()
 )

Tracked in Apple’s issue tracker as rdar://114137999