Skip to content

Conversation

@jishnub
Copy link
Member

@jishnub jishnub commented May 9, 2021

Fixes #40760

Now

julia> (false:false)[1:0]
true:false

julia> (false:true:false)[1:1:0]
0:1:-1

julia> (false:true:false)[1:0]
0:1:-1

@dkarrasch dkarrasch added the ranges Everything AbstractRange label May 9, 2021
@DilumAluthge DilumAluthge requested a review from mbauman May 10, 2021 00:52
@jishnub
Copy link
Member Author

jishnub commented Jul 4, 2021

bump

@ViralBShah
Copy link
Member

@mbauman Any thoughts here? If you generally think this is ok, we can get it rebased and merged.

@ViralBShah ViralBShah added the merge me PR is reviewed. Merge when all tests are passing label Sep 6, 2022
@ViralBShah
Copy link
Member

I believe this is good to merge.

@DilumAluthge
Copy link
Member

@ViralBShah @mbauman CI is green, but it's not clear whether or not this PR has had an approving review.

@DilumAluthge DilumAluthge removed the merge me PR is reviewed. Merge when all tests are passing label Sep 13, 2022
jishnub and others added 5 commits November 3, 2023 15:00
Reviewing the work here, it seems undesirable to me now to actually to
make the majority of this change. We already define too much of what the
value of start should be, and trying to assume that one(T):zero(T) is in
range for T<:Integer is not necessarily ideal either.

This keeps some minor semi-related changes though:
 - ensured this only happens when first(r)+first(s)*st == typemax
 - if the range is supposed to be empty, then use a step of eps=1 (as
   steprange_last_empty will do later), to reduce the size of the set of
   values that overflow and become !isempty or error to 1 value instead of
   step values
 - Handle a convoluted case of StepRangeLen{Bool} indexing into a Vector
   returning the element from the wrong end

```
julia> (typemin(Int)+1:100:zero(Int))[1:0] |> length
184467440737095516 # old
0 # new
```
@vtjnash
Copy link
Member

vtjnash commented Nov 3, 2023

@nanosoldier runbenchmarks(!"scalar", vs=":master")

@vtjnash vtjnash added merge me PR is reviewed. Merge when all tests are passing and removed forget me not labels Nov 3, 2023
@nanosoldier
Copy link
Collaborator

Your benchmark job has completed - possible performance regressions were detected. A full report can be found here.

@IanButterworth IanButterworth merged commit bd917bd into JuliaLang:master Nov 5, 2023
@giordano giordano removed the merge me PR is reviewed. Merge when all tests are passing label Nov 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ranges Everything AbstractRange

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Indexing (false:false)[1:0] fails

9 participants