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

Xcode 16: fix warnings for types that inherit @unchecked Sendable #2477

Merged
merged 1 commit into from
Sep 10, 2024

Conversation

jszumski
Copy link
Contributor

Fixes 26 warnings in Xcode 16 by restating inherited conformances to @unchecked Sendable. An example:

Sources/Private/CoreAnimation/Animations/CombinedShapeAnimation.swift:32:13 Class 'CombinedShapeItem' must restate inherited '@unchecked Sendable' conformance

The unchecked conformances were originally added in #2126.

Comment on lines +88 to +91
/// `CombinedShapeItem` inherits `@unchecked Sendable` from `ShapeItem` and
/// we need to restate that here to avoid a warning in Xcode 16
// swiftlint:disable:next no_unchecked_sendable
extension CombinedShapeItem: @unchecked Sendable { }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use a full Sendable conformance instead of @unchecked Sendable?

These model types are final and only have immutable properties, so they are Sendable without having to use @unchecked.

Suggested change
/// `CombinedShapeItem` inherits `@unchecked Sendable` from `ShapeItem` and
/// we need to restate that here to avoid a warning in Xcode 16
// swiftlint:disable:next no_unchecked_sendable
extension CombinedShapeItem: @unchecked Sendable { }
extension CombinedShapeItem: Sendable { }

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this works I would suggest putting the Sendable conformance in the main declaration instead of as an extension, like:

final class CombinedShapeItem: ShapeItem, Sendable {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately that still doesn't silence the warning

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, thanks for checking

@calda calda merged commit fc8a44f into airbnb:master Sep 10, 2024
12 checks passed
@jszumski jszumski deleted the xcode16-inherited-unchecked-sendable branch September 10, 2024 19:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants