Skip to content

[stdlib] Fix array slice self-assignment bug #10958

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

airspeedswift
Copy link
Member

Fixes SR-4503.

In-place mutation of an array slice doesn't need assigning back, but there needs to be a check that the assigned slice's bounds matches otherwise unmatched range assignments like a[1..<1] = a[1..<2] were getting thrown away.

@airspeedswift
Copy link
Member Author

@swift-ci please test

Copy link
Contributor

@jrose-apple jrose-apple left a comment

Choose a reason for hiding this comment

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

Thanks! This looks correct to me.

Copy link
Contributor

@dabrahams dabrahams left a comment

Choose a reason for hiding this comment

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

Please fix 80-column overflow; otherwise LGTM!

@airspeedswift
Copy link
Member Author

@swift-ci please test and merge

@airspeedswift airspeedswift merged commit 4d7ae8c into swiftlang:master Jul 17, 2017
@airspeedswift airspeedswift deleted the array-subscript-self-assign branch July 17, 2017 20:09
airspeedswift added a commit to airspeedswift/swift that referenced this pull request Jul 17, 2017
Fix bug where assigning from self wasn't checking bounds of the assigned slice matched
airspeedswift added a commit that referenced this pull request Jul 18, 2017
Fix bug where assigning from self wasn't checking bounds of the assigned slice matched
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants