Skip to content

[release/7.0-preview5] Refactoring the generic-math CreateChecked/Saturating/Truncating APIs to match API review #70034

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

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented May 31, 2022

Backport of #69756 and #69783 to release/7.0-preview5

/cc @tannergooding

Customer Impact

Generic Math is one of the bigger features for .NET 7 and this ensures that users can successfully create any of the built-in numeric types from any of the other built-in numeric types. Not having this change means that users need to wait another preview to validate the generic math feature including all the taken community feedback and updates given so far. The types covered by the create APIs are:

The 13 "runtime primitives":

  • byte, sbyte
  • short, ushort
  • int, uint
  • long, ulong
  • nint, nuint
  • float, double
  • char

The 5 "user-defined" types in corelib:

  • Int128, UInt128
  • decimal
  • Half
  • NFloat

There are then 2 more "user-defined" types outside corelib:

  • BigInteger
  • Complex

Testing

This has tests covering the conversions from any T to any U for the various edge cases in both directions.

Risk

Minimal, this touches a preview and is only available for use via new APIs.

@ghost
Copy link

ghost commented May 31, 2022

Note regarding the new-api-needs-documentation label:

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.

@ghost
Copy link

ghost commented May 31, 2022

I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly one area label.

Corresponds to #64717 that I somehow missed, despite commenting on it.

We still don't allow interfaces to implement methods of other interfaces. The CLR VM doesn't allow either.
@tannergooding
Copy link
Member

CC. @jeffhandley

@tannergooding tannergooding added the Servicing-consider Issue for next servicing release review label May 31, 2022
@tannergooding tannergooding removed the Servicing-consider Issue for next servicing release review label Jun 1, 2022
@tannergooding tannergooding added the Servicing-approved Approved for servicing release label Jun 1, 2022
@tannergooding
Copy link
Member

This was approved over email

@carlossanlop
Copy link
Contributor

Failures are unrelated.

@carlossanlop carlossanlop merged commit 425fedc into release/7.0-preview5 Jun 2, 2022
@carlossanlop carlossanlop deleted the backport/pr-69756-to-release/7.0-preview5 branch June 2, 2022 03:37
@ghost ghost locked as resolved and limited conversation to collaborators Jul 2, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants