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

[SR-11992] Unused variables in lazy properties should generate a warning #54426

Open
swift-ci opened this issue Jan 6, 2020 · 2 comments
Open
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself parser Area → compiler: The legacy C++ parser

Comments

@swift-ci
Copy link
Collaborator

swift-ci commented Jan 6, 2020

Previous ID SR-11992
Radar rdar://problem/58455463
Original Reporter XmasRights (JIRA User)
Type Bug
Additional Detail from JIRA
Votes 2
Component/s Compiler
Labels Bug, Parser
Assignee maustinstar (JIRA)
Priority Medium

md5: f3be1ac0399e649a845bbd0002637704

relates to:

  • SR-13821 Variables never mutated in lazy properties should generate a warning

Issue Description:

In the code below, let x = 42 appropriately gives us an 'x' was never used warning. However the let z = 42 does not.

class Foo {
    lazy var y: Int = {
        let z = 42
        return 12
    }()

    func run() {
        let x = 42 // Initialization of immutable value 'x' was never used...
    }
}

Unused variables in lazy properties should produce the unused variable warning.

@beccadax
Copy link
Contributor

beccadax commented Jan 9, 2020

@swift-ci create

@swift-ci
Copy link
Collaborator Author

swift-ci commented Nov 6, 2020

Comment by Michael Verges (JIRA)

See my PR: #34617

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself parser Area → compiler: The legacy C++ parser
Projects
None yet
Development

No branches or pull requests

2 participants