Skip to content

[Foundation] 1-ary IndexPath forms invalid range on slices #10317

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

Conversation

phausler
Copy link
Contributor

@phausler phausler commented Jun 16, 2017

This is a cherry pick of pr #10311

1-ary IndexPaths incorrectly implemented slicing for ranges of 1..<1

This resolves swiftlang/swift-corelibs-foundation#3851.

Explanation:
IndexPath had a missing case for 1..<1 in 1-ary variant storage when slicing ranges. This commit adds that missing case (since integers are not naturally exhaustive and fall into a default case they were hitting the "out of range" cases)

Scope:
This is only runtime behavior for IndexPath and is a un-common use case (but still something that we should definitely not let fail)

Radar (and possibly SR Issue):

Risk:
This is relatively low risk since it is only a runtime behavior and only changes an un-common case.

Testing:
A unit test was added testing both the reported case of dropFirst() as well as the root cause of slicing.

@phausler
Copy link
Contributor Author

@swift-ci please test

@tkremenek tkremenek merged commit e43b009 into swiftlang:swift-4.0-branch Jun 16, 2017
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.

4 participants