Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running formatter produces invalid Swift #1107

Closed
ahoppen opened this issue Mar 1, 2024 · 3 comments
Closed

Running formatter produces invalid Swift #1107

ahoppen opened this issue Mar 1, 2024 · 3 comments

Comments

@ahoppen
Copy link
Collaborator

ahoppen commented Mar 1, 2024

Formatting this code

_ = [
  Node(
    documentation: """
    A single argument that can be added to a lifetime specifier like `borrow`, `mutate`, `consume` or `copy`.

    ### Example
    `data` in `func foo(data: Array<Item>) -> borrow(data) ComplexReferenceType`
    """,
    children: [
      Child(
        documentation: """
        The parameter on which the lifetime of this type depends. 
        
        This can be an identifier referring to an external parameter name, an integer literal to refer to an unnamed
        parameter or `self` if the type's lifetime depends on the object the method is called on.
        """
      ),
    ]
  )
]

produces

_ = [
  Node(
    documentation: """
      A single argument that can be added to a lifetime specifier like `borrow`, `mutate`, `consume` or `copy`.

      ### Example
      `data` in `func foo(data: Array<Item>) -> borrow(data) ComplexReferenceType`
      """,
    children: [
      Child(
        documentation: """
          The parameter on which the lifetime of this type depends. 
 
         This can be an identifier referring to an external parameter name, an integer literal to refer to an unnamed
          parameter or `self` if the type's lifetime depends on the object the method is called on.
          """
      )
    ]
  )
]

Which is invalid because This can be has insufficient indentation. Instead, the previous line has a single space when it shouldn’t have any.

@ahoppen
Copy link
Collaborator Author

ahoppen commented Mar 1, 2024

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

@tristanlabelle
Copy link
Contributor

Possibly related. Before formatting:

image

After formatting:

image

@ahoppen
Copy link
Collaborator Author

ahoppen commented Mar 8, 2024

I think this should be fixed by #1118

@ahoppen ahoppen closed this as completed May 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants