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

Adopt Sendable in NIOTestUtils #2199

Merged
merged 5 commits into from
Jun 20, 2022
Merged

Conversation

dnadoba
Copy link
Member

@dnadoba dnadoba commented Jun 17, 2022

Incremental Sendable adoption.

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.
@dnadoba dnadoba added the 🔼 needs-minor-version-bump For PRs that when merged cause a bump of the minor version, ie. 1.x.0 -> 1.(x+1).0 label Jun 17, 2022
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
/// `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`.
Copy link
Contributor

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.
Copy link
Contributor

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.

@dnadoba dnadoba requested a review from Lukasa June 20, 2022 11:08
@Lukasa Lukasa merged commit b73fc4e into apple:main Jun 20, 2022
@dnadoba dnadoba deleted the dn-sendable-testutils branch June 20, 2022 13:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔼 needs-minor-version-bump For PRs that when merged cause a bump of the minor version, ie. 1.x.0 -> 1.(x+1).0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants