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

Remove some unnecessary @unchecked Sendables. #233

Merged
merged 3 commits into from
Sep 26, 2024

Conversation

mbrandonw
Copy link
Member

We have a few @unchecked Sendables that aren't really necessary, so cleaning them up.

@@ -677,13 +676,12 @@ where Base.Value: Hashable {
}
}

private final class _UIBindingEnumToOptionalCase<Base: _UIBinding, Case>: _UIBinding, @unchecked
Sendable
private final class _UIBindingEnumToOptionalCase<Base: _UIBinding, Case>: _UIBinding
Copy link
Member

@stephencelis stephencelis Sep 25, 2024

Choose a reason for hiding this comment

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

This lose the Sendable? Or is it implicit and can we remove the explicit one above?

Suggested change
private final class _UIBindingEnumToOptionalCase<Base: _UIBinding, Case>: _UIBinding
private final class _UIBindingEnumToOptionalCase<Base: _UIBinding, Case>: _UIBinding, Sendable

Or should it be conditional?

Copy link
Member Author

Choose a reason for hiding this comment

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

_UIBinding is : Sendable so we already get it.

Copy link
Member

@stephencelis stephencelis left a comment

Choose a reason for hiding this comment

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

Looks good! Just a few considerations.

Comment on lines 2 to 3
public typealias _KeyPath<Root, Value> = any KeyPath<Root, Value> & Sendable
public typealias _WritableKeyPath<Root, Value> = any WritableKeyPath<Root, Value> & Sendable
Copy link
Member

Choose a reason for hiding this comment

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

Wonder if we make this explicit for readability:

Suggested change
public typealias _KeyPath<Root, Value> = any KeyPath<Root, Value> & Sendable
public typealias _WritableKeyPath<Root, Value> = any WritableKeyPath<Root, Value> & Sendable
public typealias _SendableKeyPath<Root, Value> = any KeyPath<Root, Value> & Sendable
public typealias _SendableWritableKeyPath<Root, Value> = any WritableKeyPath<Root, Value> & Sendable

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep good idea, done! I can do that over in TCA too.

@mbrandonw mbrandonw merged commit b39de7d into main Sep 26, 2024
8 checks passed
@mbrandonw mbrandonw deleted the remove-some-unchecked-sendables branch September 26, 2024 13:20
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