-
Notifications
You must be signed in to change notification settings - Fork 670
Adopt Sendable
in NIOTestUtils
#2199
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The parameter `decoderFactory` of the static methods `ByteToMessageDecoderVerifier.verifyDecoder` do not need to be `@escaping`. I have made them non-escaping as part of `Sendable` adoption because we would otherwise need to think about if they should be `@Sendable` too. `VerificationError` is interesting, see the code comment for more information.
The parameter `decoderFactory` of the static methods `ByteToMessageDecoderVerifier.verifyDecoder` do not need to be `@escaping`. I have made them non-escaping as part of `Sendable` adoption because we would otherwise need to think about if they should be `@Sendable` too. `VerificationError` is interesting, see the code comment for more information.
…into dn-sendable-testutils # Conflicts: # Sources/NIOTestUtils/NIOHTTP1TestServer.swift
Lukasa
reviewed
Jun 20, 2022
/// `VerificationError` conforms to `Error` and therefore `Sendable`. | ||
/// `VerificationError` has a stored property `errorCode` of type `ErrorCode` which can store `NIOAny` which is not and can not be `Sendable`. | ||
/// In addtion, `ErrorCode` can also store a user defined `OutputType` which is not required to be `Sendable` but we could require it to be `Sendable`. | ||
/// We have to choises, we could either lie and confrom `ErrorCode` to `Sendable` with `@unchecked` or do the same but for `VerificationError`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggested change
/// We have to choises, we could either lie and confrom `ErrorCode` to `Sendable` with `@unchecked` or do the same but for `VerificationError`. | |
/// We have two choices, we could either lie and conform `ErrorCode` to `Sendable` with `@unchecked` or do the same but for `VerificationError`. |
/// `VerificationError` has a stored property `errorCode` of type `ErrorCode` which can store `NIOAny` which is not and can not be `Sendable`. | ||
/// In addtion, `ErrorCode` can also store a user defined `OutputType` which is not required to be `Sendable` but we could require it to be `Sendable`. | ||
/// We have to choises, we could either lie and confrom `ErrorCode` to `Sendable` with `@unchecked` or do the same but for `VerificationError`. | ||
/// As `VerificationError` already conforms to `Sendable` this sounds like the best option and this still allows us to adopt `Sendable` for `ErrorCode` later. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you clarify that the reason VerificationError
already conforms to Sendable
is that it's of type Error
, which must conform.
Lukasa
approved these changes
Jun 20, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Incremental
Sendable
adoption.The parameter
decoderFactory
of the static methodsByteToMessageDecoderVerifier.verifyDecoder
do not need to be@escaping
. I have made them non-escaping as part ofSendable
adoption because we would otherwise need to think about if they should be@Sendable
too.VerificationError
is interesting, see the code comment for more information.