forked from JuliaLang/julia
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Boundschecks for searchsorted & remove step(r::Range)==0 tests"
This reverts commit 10e51e5. Originally merged by 2d5dbf3, this is incorrect in a number of ways. The searchsorted* methods with explicit lo and hi indices are an not part of the public API for these functions. Thus, the correctness of the bounds given don't need to be checked – that is up to the caller. If we decide to expose the ability to call searchsorted* with explicit start and end indices, there should be a better API for that which doesn't require passing an Ordering object and which checks bounds. In particular, this broke the old behavior of searchsorted when the value that's being searched for is not in the array. Fix JuliaLang#7916. Also added somes tests to make sure this doesn't regress again. At the time this was committed, I think that ranges could actually have a zero step – there was a reason for that check to be there. This may no longer be the case, but since it's cheap to check, we may as well handle it correctly and decouple the correctness of the sorting functions from a detail of the range implementation. Conflicts: base/sort.jl
- Loading branch information
1 parent
07b75b9
commit fda850b
Showing
2 changed files
with
25 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters