-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
redundant_optional_initialization rule bug #1159
Labels
bug
Unexpected and reproducible misbehavior.
Comments
Are you using Swift 2.3? |
@marcelofabri Swift 3.0 |
I couldn't reproduce it with Swift 3.0 and 0.16 😬 Are you sure this isolated example triggers? |
@marcelofabri sorry for wrong example Here is new code which repoduce bug class Address: NSObject {
let country: String?
let city: String?
lazy private(set) var fullAddress: String? = {
var names = [String]()
if self.country != nil && self.country!.isEmpty == false {
names.append(self.country!)
}
if self.city != nil && self.city!.isEmpty == false {
names.append(self.city!)
}
return names.joined(separator: ", ")
}()
init(country: String?, city: String?) {
self.country = country
self.city = city
}
} code |
OK, I was able to reproduce it now. Thanks! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
this code (self.name != nil) cause redundant_optional_initialization violation
SwiftLint 0.16.0
The text was updated successfully, but these errors were encountered: