False positive: unused_declaration flagging projectedValue of property wrapper
Nobody has claimed this yet.
- Dominant language
- Swift
- Stars
- 19.7k
- Forks
- 2.3k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 11
Description
Describe the bug
Swiftlint is identifying the projectedValue of a property wrapper as unused.
Environment
-
SwiftLint version (run
swiftlint versionto be sure)? 0.39.2 -
Installation method used (Homebrew, CocoaPods, building from source, etc)? Homebrew
-
Are you using nested configurations? No
-
Which Xcode version are you using (check
xcodebuild -version)? Xcode 11.3.1 Build version 11C505 -
Do you have a sample that shows the issue?
@propertyWrapper
final class LockedWhenRead<Value: Equatable> {
/// Allows access outside of private scope.
var projectedValue: LockedWhenRead<Value> { return self }
var wrappedValue: Value {
get { self.getAndLockValue() }
set { self.storeAndSet(newValue) }
}
private func getAndLockValue() -> Value {
...
}
private func storeAndSet(_ newValue: Value) {
...
}
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the reported example with SwiftLint 0.39.2 and the unused_declaration rule, focusing on the property wrapper's projectedValue. Trace how the rule classifies projectedValue and verify the fix against the sample so that a valid projectedValue is no longer reported as unused.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100