We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I found what is definitely an edge case, but still a valid case of autocorrect producing source that won't compile.
Running autocorrect on the following file
class TestClass { private lazy var test: Int? = nil }
will produce the output
class TestClass { private lazy var test: Int? }
Xcode will then let you know lazy vars require an initializer.
lazy var
If the code is
class TestClass { private lazy var test: Int? = 0 }
Everything is fine. It only happens with nil.
nil
Obviously, having a lazy var initialize to nil makes no sense. No clue why it was written like that.
I could also see this being a reasonable warning to add. lazy var x: Any? = nil is probably a smell.
lazy var x: Any? = nil
The text was updated successfully, but these errors were encountered:
We should definitely fix this, but it's probably super low priority for the reasons you've outlined.
Sorry, something went wrong.
redundant_optional_initialization
lazy
No branches or pull requests
I found what is definitely an edge case, but still a valid case of autocorrect producing source that won't compile.
Running autocorrect on the following file
will produce the output
Xcode will then let you know
lazy var
s require an initializer.If the code is
Everything is fine. It only happens with
nil
.Obviously, having a
lazy var
initialize tonil
makes no sense. No clue why it was written like that.I could also see this being a reasonable warning to add.
lazy var x: Any? = nil
is probably a smell.The text was updated successfully, but these errors were encountered: