-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Closed
Labels
bugUnexpected and reproducible misbehavior.Unexpected and reproducible misbehavior.
Description
New Issue Checklist
- I've Updated SwiftLint to the latest version.
- I've searched for existing GitHub issues.
Bug Description
When declaring a protocol
SwiftLint generates a false-positive for a class_delegate_protocol
violation when AnyObject
is added via &
.
/// "Class Delegate Protocol Violation: Delegate protocols should be class-only so they can be weakly referenced (class_delegate_protocol)"
protocol SomeDelegate: AnyObject & Sendable {
}
/// No error.
protocol SomeDelegate: AnyObject, Sendable {
}
I realize technically speaking AnyObject & Sendable
is technically a different type than independently AnyObject
and Sendable
, but the principle the rule is trying to get at should resolve the same.
Command/Output
$ swiftlint --strict
Class Delegate Protocol Violation: Delegate protocols should be class-only so they can be weakly referenced (class_delegate_protocol)
Environment
- SwiftLint version: 0.57.0
- Xcode version: 16.2.0
- Installation method used: Homebrew
- Configuration file: default
Are you using nested configurations? If so, paste their
relative paths and respective contents.
- No nested config
Metadata
Metadata
Assignees
Labels
bugUnexpected and reproducible misbehavior.Unexpected and reproducible misbehavior.