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

False positive with dictionary key #412

Open
sdc-78 opened this issue Oct 14, 2021 · 2 comments
Open

False positive with dictionary key #412

sdc-78 opened this issue Oct 14, 2021 · 2 comments
Labels
apple bug A bug in Swift bug A bug in Periphery

Comments

@sdc-78
Copy link

sdc-78 commented Oct 14, 2021

Hello,

With the following code:

class Foo {

    private let key = "the-key"

    func run() {
        var dictionary: [String: Any] = [:]
        dictionary[key] = 42 // <-- `key` is used there!
        print(dictionary.count)
    }
}

Foo().run()

Periphery 2.8.1 reports:

warning: Property 'key' is assigned, but never used

Note: If I add key in the print(...) statement, the warning disappears.

@sdc-78
Copy link
Author

sdc-78 commented Oct 15, 2021

It looks like https://bugs.swift.org/browse/SR-14162 but here it's not a static property.

@ileitch ileitch added apple bug A bug in Swift bug A bug in Periphery labels Oct 16, 2021
@ileitch
Copy link
Contributor

ileitch commented Oct 16, 2021

Yep, that's the same issue. I'm planning to try fix this issue myself, in time for Swift 5.6... but I've hardly any time recently for Periphery.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
apple bug A bug in Swift bug A bug in Periphery
Projects
None yet
Development

No branches or pull requests

2 participants