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

unneeded_synthesized_initializer removes needed initializers if there is any other initializer enclosed within conditional macro #5574

Closed
2 tasks done
tristanSIF opened this issue May 14, 2024 · 0 comments · Fixed by #5581
Assignees
Labels
bug Unexpected and reproducible misbehavior.

Comments

@tristanSIF
Copy link

New Issue Checklist

Describe the bug

struct Foo {
    var bar: String

   // warning or removed according to unneeded_synthesized_initializer
    init(bar: String) {
        self.bar = bar
    }

    // or any other macros, such as canImport
    #if DEBUG  
    init(data: CGFloat) {
        self.bar = "\(data)"
    }
    #endif
}

/// compile error if autocorrect
let foo = Foo(bar: "bar")

Environment

  • SwiftLint version: 0.55.0 / 0.53.0
  • Installation method used: CocoaPods / Homebrew
@SimplyDanny SimplyDanny added the bug Unexpected and reproducible misbehavior. label May 14, 2024
@SimplyDanny SimplyDanny self-assigned this May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Unexpected and reproducible misbehavior.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants