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
OS: macOS 10.15.7
Xcode: 12.1 (12A7403)
SDK: iOS 14.1
md5: a76f43f6511ceb0126fc0e579f8fd3ba
relates to:
Issue Description:
In the code below, var x = 42 appropriately gives us an 'x' was never mutated warning. However, the var z = 42 does not.
var x = 42
'x' was never mutated
var z = 42
class Foo { lazy var y: Int = { var z = 42 return z }() func run() { var x = 42 // Variable 'x' was never mutated; consider changing to 'let' constant print("\(x)") } }
Variables never mutated in lazy properties should produce the never mutated variable warning.
The text was updated successfully, but these errors were encountered:
This doesn't seem to be related to lazy properties specifically.
struct S { var x: Int = { var y = 42 return y }() }
Also does not show any warning.
Sorry, something went wrong.
@swift-ci create
Comment by Michael Verges (JIRA)
See my PR: #34617
No branches or pull requests
Environment
OS: macOS 10.15.7
Xcode: 12.1 (12A7403)
SDK: iOS 14.1
Additional Detail from JIRA
md5: a76f43f6511ceb0126fc0e579f8fd3ba
relates to:
Issue Description:
In the code below,
var x = 42
appropriately gives us an'x' was never mutated
warning. However, thevar z = 42
does not.Variables never mutated in lazy properties should produce the never mutated variable warning.
The text was updated successfully, but these errors were encountered: