Skip to content

Commit ae208f5

Browse files
committed
Merge pull request #8043 from JuliaLang/jq/range
Add fallback constructor for similar() on ranges
2 parents 1b44391 + e17867a commit ae208f5

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

base/range.jl

+1
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ linrange(a::Real, b::Real, len::Integer) =
164164

165165
## interface implementations
166166

167+
similar(r::Range, T::Type, dims::(Integer...)) = Array(T, dims...)
167168
similar(r::Range, T::Type, dims::Dims) = Array(T, dims)
168169

169170
size(r::Range) = (length(r),)

test/ranges.jl

+6
Original file line numberDiff line numberDiff line change
@@ -344,3 +344,9 @@ for r in (0:1, 0.0:1.0)
344344
@test r*im == [r]*im
345345
@test r/im == [r]/im
346346
end
347+
348+
# issue #7709
349+
@test length(map(identity, 0x01:0x05)) == 5
350+
@test length(map(identity, 0x0001:0x0005)) == 5
351+
@test length(map(identity, uint64(1):uint64(5))) == 5
352+
@test length(map(identity, uint128(1):uint128(5))) == 5

0 commit comments

Comments
 (0)