Add retroactive to Equatable conformance to fix compiler warnings#883
Add retroactive to Equatable conformance to fix compiler warnings#883
retroactive to Equatable conformance to fix compiler warnings#883Conversation
There was a problem hiding this comment.
Pull request overview
This pull request adds the @retroactive attribute to Equatable protocol conformances for PlaybackTime and PlaybackPosition types to suppress Swift 6 compiler warnings about retroactive conformances. These types are C structs imported from the CSFBAudioEngine module that are being extended with protocol conformances in the Swift wrapper layer.
Changes:
- Added
@retroactivetoEquatableconformance forPlaybackTime - Added
@retroactivetoEquatableconformance forPlaybackPosition
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| Sources/SFBAudioEngine/SFBPlaybackTime.swift | Adds @retroactive attribute to Equatable conformance for the imported PlaybackTime struct |
| Sources/SFBAudioEngine/SFBPlaybackPosition.swift | Adds @retroactive attribute to Equatable conformance for the imported PlaybackPosition struct |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } | ||
|
|
||
| extension PlaybackTime: Equatable { | ||
| extension PlaybackTime: @retroactive Equatable { |
There was a problem hiding this comment.
The @retroactive attribute requires Swift 6.0 or later (introduced in SE-0364), but Package.swift declares swift-tools-version: 5.6. This will cause compilation errors for users building with Swift 5.x. Consider either:
- Updating Package.swift to require Swift 6.0 (changing
swift-tools-version: 5.6toswift-tools-version: 6.0) - Adding a compiler version check to conditionally apply the attribute:
#if swift(>=6.0)
extension PlaybackTime: @retroactive Equatable {
#else
extension PlaybackTime: Equatable {
#endif
Note that option 1 would be a breaking change for users on older Swift versions, while option 2 maintains backward compatibility but allows warnings on Swift 5.x.
| } | ||
|
|
||
| extension PlaybackPosition: Equatable { | ||
| extension PlaybackPosition: @retroactive Equatable { |
There was a problem hiding this comment.
The @retroactive attribute requires Swift 6.0 or later (introduced in SE-0364), but Package.swift declares swift-tools-version: 5.6. This will cause compilation errors for users building with Swift 5.x. Consider either:
- Updating Package.swift to require Swift 6.0 (changing
swift-tools-version: 5.6toswift-tools-version: 6.0) - Adding a compiler version check to conditionally apply the attribute:
#if swift(>=6.0)
extension PlaybackPosition: @retroactive Equatable {
#else
extension PlaybackPosition: Equatable {
#endif
Note that option 1 would be a breaking change for users on older Swift versions, while option 2 maintains backward compatibility but allows warnings on Swift 5.x.
No description provided.