You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using , instead of &, compilation results in Redundant conformance constraint 'Self.Unit' : 'Equatable'. In this example, it is important that the associated type Unit is declared as the composition of Equatable, CaseIterable, and UnitConvertible.
Complete output when running SwiftLint, including the stack trace and command used
n/a - SwiftLint runs fine. It's just too eager about suggesting that all & be changed to , in protocol compositions. Since it's in the default rule set, swiftlint lint --fix can introduce syntax errors.
Environment
SwiftLint version (run swiftlint version to be sure)? 0.47.1
Installation method used (Homebrew, CocoaPods, building from source, etc)? Homebrew
Are you using nested configurations? Yes, but not applicable to this problem.
If so, paste their relative paths and respective contents.
Which Xcode version are you using (check xcodebuild -version)? 13.4.0
Do you have a sample that shows the issue? Run echo "[string here]" | swiftlint lint --no-cache --use-stdin --enable-all-rules
to quickly test if your example is really demonstrating the issue. If your example is more
complex, you can use swiftlint lint --path [file here] --no-cache --enable-all-rules.
The text was updated successfully, but these errors were encountered:
It's unfortunate that Swift doesn't treat both in the same way - we probably should file an issue in their GitHub about it. However, I don't think there's much we can do from SwiftLint's side here without moving this to be an analyzer rule (which would make it require a full compilation, besides being much slower).
New Issue Checklist
Describe the bug
When two or more protocols are part of a protocol composition on an associated type, changing the
&
to,
can cause a syntax error. For example:When using
,
instead of&
, compilation results inRedundant conformance constraint 'Self.Unit' : 'Equatable'
. In this example, it is important that the associated typeUnit
is declared as the composition ofEquatable
,CaseIterable
, andUnitConvertible
.Complete output when running SwiftLint, including the stack trace and command used
n/a - SwiftLint runs fine. It's just too eager about suggesting that all
&
be changed to,
in protocol compositions. Since it's in the default rule set,swiftlint lint --fix
can introduce syntax errors.Environment
swiftlint version
to be sure)? 0.47.1If so, paste their relative paths and respective contents.
xcodebuild -version
)? 13.4.0echo "[string here]" | swiftlint lint --no-cache --use-stdin --enable-all-rules
to quickly test if your example is really demonstrating the issue. If your example is more
complex, you can use
swiftlint lint --path [file here] --no-cache --enable-all-rules
.The text was updated successfully, but these errors were encountered: