Skip to content

fix an edge constructor bug in LinearIndices#37928

Merged
timholy merged 1 commit intoJuliaLang:masterfrom
johnnychen94:jc/linear_test
Oct 9, 2020
Merged

fix an edge constructor bug in LinearIndices#37928
timholy merged 1 commit intoJuliaLang:masterfrom
johnnychen94:jc/linear_test

Conversation

@johnnychen94
Copy link
Copy Markdown
Member

@johnnychen94 johnnychen94 commented Oct 7, 2020

An edge case bug that gets Identified in #37829 (comment)

Integers should always be converted to Base.OneTo.

julia> LinearIndices((2, 1:3))
1×3 LinearIndices{2, Tuple{UnitRange{Int64}, UnitRange{Int64}}}:
 1  2  3

julia> LinearIndices((2, 3))
2×3 LinearIndices{2, Tuple{Base.OneTo{Int64}, Base.OneTo{Int64}}}:
 1  3  5
 2  4  6

This PR:

julia> LinearIndices((2, 1:3))
2×3 LinearIndices{2, Tuple{Base.OneTo{Int64}, Base.OneTo{Int64}}}:
 1  3  5
 2  4  6

@timholy timholy merged commit 3559b72 into JuliaLang:master Oct 9, 2020
@timholy
Copy link
Copy Markdown
Member

timholy commented Oct 9, 2020

Thanks!

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.

2 participants