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

[SR-15305] Postfix #if expressions want necessary newline removed #303

Closed
klanchman opened this issue Oct 11, 2021 · 0 comments · Fixed by #383
Closed

[SR-15305] Postfix #if expressions want necessary newline removed #303

klanchman opened this issue Oct 11, 2021 · 0 comments · Fixed by #383
Labels
bug Something isn't working swift-format

Comments

@klanchman
Copy link

Previous ID SR-15305
Radar None
Original Reporter @klanchman
Type Bug
Environment
  • macOS 11.6 (20G165)

  • swift-format 0.50500.0, release configuration

Additional Detail from JIRA
Votes 0
Component/s swift-format
Labels Bug
Assignee None
Priority Medium

md5: 06f5c44e7c1b5b10eb313c28ce66331b

Issue Description:

When using swift-format in release configuration with default settings, using postfix #if expressions causes swift-format to remove a necessary newline.

Using the code from the evolution proposal, swift-format lint outputs a warning:

VStack {
  Text("something") <<< (swift-format) warning: [RemoveLine]: remove line break
  #if os(iOS)
  .iOSSpecificModifier()
  #endif
  .commonModifier()
}

Formatting results in code that causes a compiler error:

VStack {
  Text("something")#if os(iOS) <<< (Swift) error: Consecutive statements on a line must be separated by a newline
  .iOSSpecificModifier()
  #endif
  .commonModifier()
}
@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working swift-format
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant