Skip to content

Normalization APIs using the spans #110465

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 4 commits into from
Dec 9, 2024

Conversation

tarekgh
Copy link
Member

@tarekgh tarekgh commented Dec 6, 2024

Fixes #87757

@ghost
Copy link

ghost commented Dec 6, 2024

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, 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 Dec 6, 2024

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, 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.

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 5 out of 7 changed files in this pull request and generated 1 suggestion.

Files not reviewed (2)
  • src/libraries/System.Runtime/ref/System.Runtime.cs: Evaluated as low risk
  • src/libraries/System.Private.CoreLib/src/System/Globalization/Normalization.Nls.cs: Evaluated as low risk
Comments skipped due to low confidence (4)

src/libraries/System.Private.CoreLib/src/System/Globalization/Normalization.Icu.cs:229

  • The parameter name 'strInput' should be 'source' to match the other methods.
private static void ValidateArguments(ReadOnlySpan<char> strInput, NormalizationForm normalizationForm, string paramName = "strInput")

src/libraries/System.Runtime/tests/System.Globalization.Extensions.Tests/Normalization/StringNormalizationTests.cs:74

  • [nitpick] The comment about the extra character in the buffer for NLS should be documented more clearly.
Span<char> destination = new char[expected.Length + 1]; // NLS sometimes need extra character in the buffer mostly if need to insert the null terminator

src/libraries/System.Runtime/tests/System.Globalization.Extensions.Tests/Normalization/StringNormalizationTests.cs:121

  • Ensure consistent error messages for invalid normalization forms.
Assert.Throws<ArgumentException>(() => "\uFB01".Normalize((NormalizationForm)7));

src/libraries/System.Private.CoreLib/src/System/StringNormalizationExtensions.cs:82

  • The summary comment for the method GetNormalizedLength is not properly aligned. Ensure that all summary comments are consistent in formatting and detail.
/// <summary>

…Normalization.Icu.cs

Co-authored-by: Günther Foidl <gue@korporal.at>
@ericstj
Copy link
Member

ericstj commented Dec 9, 2024

/ba-g #110517 fixed build issue here

Copy link
Member

@ericstj ericstj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feedback has been addressed, builds passing modulo one known issue. I noticed a small whitespace issue which I will fix and merge.

@ericstj ericstj merged commit a5af0ab into dotnet:main Dec 9, 2024
9 checks passed
hez2010 pushed a commit to hez2010/runtime that referenced this pull request Dec 14, 2024
* Normalization APIs using the spans

* Address the feedback

* Update src/libraries/System.Private.CoreLib/src/System/Globalization/Normalization.Icu.cs

Co-authored-by: Günther Foidl <gue@korporal.at>

* Fix comment indent

---------

Co-authored-by: Günther Foidl <gue@korporal.at>
Co-authored-by: Eric StJohn <ericstj@microsoft.com>
@github-actions github-actions bot locked and limited conversation to collaborators Jan 9, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[API Proposal]: ReadOnlySpan<char> overloads for StringNormalizationExtensions
5 participants