-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Add MemoryExtensions overloads with comparer #110197
Add MemoryExtensions overloads with comparer #110197
Conversation
Note regarding the
|
Note regarding the
|
6958f74
to
da01401
Compare
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.
Copilot reviewed 8 out of 17 changed files in this pull request and generated 3 comments.
Files not reviewed (9)
- src/libraries/System.Memory/tests/System.Memory.Tests.csproj: Language not supported
- src/libraries/System.Memory/tests/ReadOnlySpan/IndexOfSequence.T.cs: Evaluated as low risk
- src/libraries/System.Memory/tests/ReadOnlySpan/LastIndexOfSequence.T.cs: Evaluated as low risk
- src/libraries/System.Memory/tests/ReadOnlySpan/EndsWith.T.cs: Evaluated as low risk
- src/libraries/System.Memory/tests/ReadOnlySpan/SequenceCompareTo.T.cs: Evaluated as low risk
- src/libraries/System.Memory/tests/ReadOnlySpan/LastIndexOf.T.cs: Evaluated as low risk
- src/libraries/System.Memory/tests/ReadOnlySpan/IndexOf.T.cs: Evaluated as low risk
- src/libraries/System.Memory/tests/ReadOnlySpan/StartsWith.T.cs: Evaluated as low risk
- src/libraries/System.Memory/ref/System.Memory.cs: Evaluated as low risk
Comments suppressed due to low confidence (4)
src/libraries/System.Linq/src/System/Linq/Contains.cs:21
- The new overload for Contains using a comparer should have corresponding unit tests to ensure it behaves correctly with different comparers.
if (source.TryGetSpan(out ReadOnlySpan<TSource> span))
src/libraries/System.Linq/src/System/Linq/Contains.cs:32
- The check for value types should be removed as it is redundant. The logic for handling null comparers should be consistent regardless of whether TSource is a value type or not.
if (typeof(TSource).IsValueType)
src/libraries/System.Diagnostics.TraceSource/src/System/Diagnostics/TraceUtils.cs:22
- The Contains method used here does not specify a comparer, which might lead to incorrect behavior if the default equality comparer is not appropriate for the type of elements in supportedAttributes.
if (supportedAttributes is null || !supportedAttributes.Contains(key))
src/libraries/System.Memory/tests/ReadOnlySpan/Contains.T.cs:124
- The test should include a case where the comparer is null to ensure the method handles it correctly.
Assert.All(GetDefaultEqualityComparers<string>(), comparer => Assert.False(new ReadOnlySpan<string>(Array.Empty<string>()).Contains("a", comparer)));
Tip: If you use Visual Studio Code, you can request a review from Copilot before you push from the "Source Control" tab. Learn more
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.
Copilot reviewed 8 out of 17 changed files in this pull request and generated 1 comment.
Files not reviewed (9)
- src/libraries/System.Memory/tests/System.Memory.Tests.csproj: Language not supported
- src/libraries/System.Linq/src/System/Linq/Contains.cs: Evaluated as low risk
- src/libraries/System.Memory/ref/System.Memory.cs: Evaluated as low risk
- src/libraries/System.Memory/tests/ReadOnlySpan/Comparers.cs: Evaluated as low risk
- src/libraries/System.Memory/tests/ReadOnlySpan/Contains.T.cs: Evaluated as low risk
- src/libraries/System.Memory/tests/ReadOnlySpan/Count.T.cs: Evaluated as low risk
- src/libraries/System.Diagnostics.TraceSource/src/System/Diagnostics/TraceUtils.cs: Evaluated as low risk
- src/libraries/System.Memory/tests/ReadOnlySpan/IndexOfSequence.T.cs: Evaluated as low risk
- src/libraries/System.Memory/tests/ReadOnlySpan/LastIndexOfSequence.T.cs: Evaluated as low risk
Comments suppressed due to low confidence (1)
src/libraries/System.Memory/tests/ReadOnlySpan/SequenceCompareTo.T.cs:140
- The method 'GetDefaultComparers' is not defined in the provided code. Ensure that 'GetDefaultComparers' is defined and correctly implemented to avoid compilation errors.
Assert.All(GetDefaultComparers<string>(), comparer => Assert.Equal(0, new ReadOnlySpan<string>(a, 1, 0).SequenceCompareTo<string>(new ReadOnlySpan<string>(a, 2, 0), comparer)));
Tip: Copilot only keeps its highest confidence comments to reduce noise and keep you focused. Learn more
* main: (89 commits) Add Dispose for X509Chain instance (dotnet#110740) Fix XML comment on regex split enumerator (dotnet#111572) JIT: tolerate missing InitClass map in SPMI (dotnet#111555) Build ilasm/ildasm packages for the host machine (dotnet#111512) Unicode 16.0 Support (dotnet#111469) Improve performance of interface method resolution in ILC (dotnet#103066) Fix building the host-targeting components and packing ILC (dotnet#111552) Improve JSON validation perf (dotnet#111332) Update github-merge-flow.jsonc to autoflow 9.0 to 9.0-staging (dotnet#111549) Include GPL-3 licence text in the notice (dotnet#111528) Remove explicit __compact_unwind entries from x64 assembler (dotnet#111530) Add MemoryExtensions overloads with comparer (dotnet#110197) Avoid capturing the ExecutionContext for the whole HTTP connection lifetime (dotnet#111475) Forward DefaultArtifactVisibility down from the VMR orchestrator (dotnet#111513) Fix relocs errors on riscv64 (dotnet#111317) Added JITDUMP_USE_ARCH_TIMESTAMP support. (dotnet#111359) add rcl/rcr tp and latency info (dotnet#111442) Fix stack overflow in compiler-generated state (dotnet#109207) Produce a package with the host-running ILC for repos in the VMR (dotnet#111443) Delete dead code in ilasm PE writer (dotnet#111218) ...
Closes #28934