Skip to content
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

Fixed ReadOnlySpan2D<T>.Slice parameters order #3951

Merged

Conversation

Sergio0694
Copy link
Member

Fixup for #3353

PR Type

What kind of change does this PR introduce?

  • Bugfix

Overview

ReadOnlySpan2D<T>.Slice has the incorrect ordering for the height and width parameters, which is inverted with respect to those in Span2D<T>.Slice. This is an oversight from a refactor in the original PR, and as a result it also causes the ReadOnlySpan2D<T>.this[Range, Range] indexer to fail for ReadOnlySpan2D<T>. This PR fixes both issues and adds a new series of tests for the two indexers as well. We probably didn't notice this before since those indexers are not available on UWP 🤔

NOTE: this PR technically introduces a breaking change (swapped parameters in the .Slice method, but as that's an issue and not intended, and also because they're in the right order in Span2D<T>, it's more of a fix than an actual breaking change.

PR Checklist

Please check if your PR fulfills the following requirements:

  • Tested code with current supported SDKs
  • Pull Request has been submitted to the documentation repository instructions. Link:
  • Sample in sample app has been added / updated (for bug fixes / features)
  • New major technical changes in the toolkit have or will be added to the Wiki e.g. build changes, source generators, testing infrastructure, sample creation changes, etc...
  • Tests for the changes have been added (for bug fixes / features) (if applicable)
  • Header has been added to all new source files (run build/UpdateHeaders.bat)
  • Contains NO breaking changes

@Sergio0694 Sergio0694 added bug 🐛 An unexpected issue that highlights incorrect behavior introduce breaking changes 💥 high-performance 🚂 Issues/PRs for the Microsoft.Toolkit.HighPerformance package labels Apr 20, 2021
@ghost
Copy link

ghost commented Apr 20, 2021

Thanks Sergio0694 for opening a Pull Request! The reviewers will test the PR and highlight if there is any conflict or changes required. If the PR is approved we will proceed to merge the pull request 🙌

@ghost ghost requested review from michael-hawker, azchohfi, Kyaa-dost and Rosuavio April 20, 2021 10:28
@Sergio0694 Sergio0694 changed the title Bugfix/readonlyspan2d slice params Fixed ReadOnlySpan2D<T>.Slice parameters order Apr 20, 2021
@Sergio0694
Copy link
Member Author

@michael-hawker If we're considering doing a "hotfix release" before 7.1.0, I think this could be a good fit as well? 🙂
As in, the Range indexer for ROS2D<T> is broken, and the Slice params in ROS2D<T> are inverted - the sooner this is published so that the type is working correctly there and consistent with S2D<T>, the better, and hopefully nobody noticed it yet 😄

@Sergio0694 Sergio0694 force-pushed the bugfix/readonlyspan2d-slice-params branch from d9dca5a to 4cdaf0f Compare April 21, 2021 12:52
Copy link
Contributor

@Rosuavio Rosuavio left a comment

Choose a reason for hiding this comment

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

Good fix!

@michael-hawker michael-hawker added this to the 7.1 milestone Apr 22, 2021
@ghost
Copy link

ghost commented Apr 22, 2021

Hello @Sergio0694!

Because this pull request has the auto merge :zap: label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@Sergio0694 Sergio0694 force-pushed the bugfix/readonlyspan2d-slice-params branch from 4cdaf0f to 6e40cf8 Compare April 22, 2021 21:22
@ghost ghost merged commit 842e2ff into CommunityToolkit:master Apr 22, 2021
Sergio0694 added a commit to Sergio0694/WindowsCommunityToolkit that referenced this pull request Apr 24, 2021
@michael-hawker michael-hawker modified the milestones: 7.1, 7.0.2 May 11, 2021
Sergio0694 added a commit to CommunityToolkit/dotnet that referenced this pull request Oct 29, 2021
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto merge ⚡ bug 🐛 An unexpected issue that highlights incorrect behavior high-performance 🚂 Issues/PRs for the Microsoft.Toolkit.HighPerformance package hotfix 🌶 introduce breaking changes 💥
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants