-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Ensure that CreateChecked, CreateSaturating, and CreateTruncating are publicly exposed #71493
Conversation
… publicly exposed
Note regarding the This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, to please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change. |
Tagging subscribers to this area: @dotnet/area-system-numerics Issue DetailsThese were meant to be publicly accessible, but interface DIMs aren't available by default on the implementing type, they have to be redeclared to be part of the public API surface.
|
@@ -528,6 +528,63 @@ bool IBinaryInteger<byte>.TryWriteLittleEndian(Span<byte> destination, out int b | |||
/// <inheritdoc cref="INumberBase{TSelf}.Abs(TSelf)" /> | |||
static byte INumberBase<byte>.Abs(byte value) => value; | |||
|
|||
/// <inheritdoc cref="INumberBase{TSelf}.CreateChecked{TOther}(TOther)" /> | |||
[MethodImpl(MethodImplOptions.AggressiveInlining)] |
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.
We don't have a language mechanism for explicitly invoking the base implementation? That seems like a hole (we probably discussed) that we should address. It's one thing to have a bit of boilerplate that forces us to redeclare the method as a one-liner that just delegates, but having to redo the whole implementation is unfortunate.
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.
Right, this is a general (and unfortunate) "issue" with DIMs. Ideally the language team comes up with a way to give access to this.
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.
cc: @MadsTorgersen and @jaredpar just to see the impact
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.
LGTM, seems to be the best solution currently available.
These were meant to be publicly accessible, but interface DIMs aren't available by default on the implementing type, they have to be redeclared to be part of the public API surface.