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

Incorrect formatting when disabling #if indentation in a postfix expression #944

Open
bnbarham opened this issue Feb 21, 2025 · 1 comment

Comments

@bnbarham
Copy link
Contributor

Consider the following snippet:

func foo() {
  #if BOOP
  boop("hi")
  #else
  boop("there")
  #endif
}

func foo2() {
  booper
  #if BOOP
  .boop("hi")
  #else
  .boop("there")
  #endif
}

When #if indentation is disabled, this becomes:

func foo() {
  #if BOOP
  boop("hi")
  #else
  boop("there")
  #endif
}

func foo2() {
  booper
    #if BOOP
  .boop("hi")
    #else
  .boop("there")
    #endif
}

The first case is correctly indented, but in the second the .boop loses the indentation that it should have (ie. the same indentation as the #if)

@ahoppen
Copy link
Member

ahoppen commented Feb 22, 2025

Synced to Apple’s issue tracker as rdar://145352415

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