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

NoAccessLevelOnExtensionDeclaration doesn't apply access modifier on members guarded by #if #966

Open
ahoppen opened this issue Mar 18, 2025 · 0 comments · May be fixed by #969
Open

NoAccessLevelOnExtensionDeclaration doesn't apply access modifier on members guarded by #if #966

ahoppen opened this issue Mar 18, 2025 · 0 comments · May be fixed by #969

Comments

@ahoppen
Copy link
Member

ahoppen commented Mar 18, 2025

Reproducer:

public extension Foo {
#if os(ios)
    static let x = 10
#endif
    static let y = 10
}

Gets formatted to

extension Foo {
  #if os(ios)
    static let x = 10
  #endif
  public static let y = 10
}

But should be

extension Foo {
  #if os(ios)
    public static let x = 10
  #endif
  public static let y = 10
}

rdar://146604297

allevato added a commit to allevato/swift-format that referenced this issue Mar 20, 2025
allevato added a commit to allevato/swift-format that referenced this issue Mar 21, 2025
allevato added a commit to allevato/swift-format that referenced this issue Mar 21, 2025
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

Successfully merging a pull request may close this issue.

1 participant