Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions base/range.jl
Original file line number Diff line number Diff line change
Expand Up @@ -499,10 +499,11 @@ end

getindex(r::Range, ::Colon) = copy(r)

function getindex{T<:Integer}(r::UnitRange, s::AbstractUnitRange{T})
function getindex{T<:Integer}(r::AbstractUnitRange, s::AbstractUnitRange{T})
@_inline_meta
@boundscheck checkbounds(r, s)
st = oftype(r.start, r.start + first(s)-1)
f = first(r)
st = oftype(f, f + first(s)-1)
range(st, length(s))
end

Expand Down
1 change: 1 addition & 0 deletions test/ranges.jl
Original file line number Diff line number Diff line change
Expand Up @@ -755,6 +755,7 @@ r = Base.OneTo(3)
@test minimum(r) == 1
@test maximum(r) == 3
@test r[2] == 2
@test r[2:3] === 2:3
@test_throws BoundsError r[4]
@test_throws BoundsError r[0]
@test r+1 === 2:4
Expand Down