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

Switch a numericCast to the required type #920

Merged
merged 1 commit into from
Aug 6, 2020

Conversation

glbrntt
Copy link
Collaborator

@glbrntt glbrntt commented Aug 5, 2020

Motivation:

The server codec uses numericCast to turn an Int into _Capacity in
order to call ByteBuffer.clear(minimumCapacity:) which accidentally
requires an underscore-internal type for capacity. The as yet unreleased
fix in NIO deprecates that function and adds an identical signature
using Int instead of _Capacity.

Using numericCast in this instance will result in a compiler error
since the type is ambiguous.

Modifications:

  • Replace the numericCast with UInt32, the alias of _Capacity.

Result:

  • When the NIO fix is released, gRPC will still be able to compile.

Motivation:

The server codec uses `numericCast` to turn an `Int` into `_Capacity` in
order to call `ByteBuffer.clear(minimumCapacity:)` which accidentally
requires an underscore-internal type for capacity. The as yet unreleased
fix in NIO deprecates that function and adds an identical signature
using `Int` instead of `_Capacity`.

Using `numericCast` in this instance will result in a compiler error
since the type is ambiguous.

Modifications:

- Replace the `numericCast` with `UInt32`, the alias of `_Capacity`.

Result:

- When the NIO fix is released, gRPC will still be able to compile.
@glbrntt glbrntt added the 🔨 semver/patch No public API change. label Aug 5, 2020
@glbrntt glbrntt requested a review from Lukasa August 5, 2020 16:18
@Lukasa Lukasa merged commit 2006e52 into grpc:main Aug 6, 2020
@glbrntt glbrntt deleted the gb-numeric-cast branch August 6, 2020 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔨 semver/patch No public API change.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants