Skip to content

Conversation

@xtqqczze
Copy link
Contributor

  • Replace AsSpan().Slice(start, length) with AsSpan(start, length)
  • Replace AsMemory().Slice(start, length) with AsMemory(start, length)

Replace `AsSpan().Slice(start, length)` with `AsSpan(start, length)`
Replace `AsMemory().Slice(start, length)` with `AsMemory(start, length)`
Copy link
Member

@GrabYourPitchforks GrabYourPitchforks left a comment

Choose a reason for hiding this comment

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

Normally I'd suggest not making changes to unit test files, as we could inadvertently bypass legitimate tests. In the case of AsSpan.cs, there are unit tests that validate that AsSpan().Slice(...) and AsSpan(...) have the same result, and doing a search-and-replace of these patterns will end up essentially removing the value that such tests would've given us.

That said, it looks like in the case of GuidArrayAsSpanWithStartAndLength the test actually did intend to test AsSpan(...) instead of AsSpan().Slice(...), if we're following the same pattern used by the other tests whose names end in the suffix *AsSpanWithStartAndLength.

But in the future please try to limit these changes to non-test code. Thanks!

@stephentoub stephentoub merged commit 1edc35f into dotnet:master Nov 30, 2020
@xtqqczze
Copy link
Contributor Author

In the case of AsSpan.cs, there are unit tests that validate that AsSpan().Slice(...) and AsSpan(...) have the same result, and doing a search-and-replace of these patterns will end up essentially removing the value that such tests would've given us.

@GrabYourPitchforks These tests were not part of the merged changes?

@xtqqczze
Copy link
Contributor Author

But in the future please try to limit these changes to non-test code. Thanks!

Yeah I did think twice about making these changes to tests, but in the case of GuidArrayAsSpanWithStartAndLength and others, they made sense.

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.

5 participants