Skip to content

Commit

Permalink
fix #9962, eltype(0:1//3:10)
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson committed Feb 2, 2015
1 parent 2f97c78 commit c42ff2d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions base/range.jl
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ range{T}(a::T, len::Integer) =
colon{A<:Real,C<:Real}(a::A, b, c::C) = colon(convert(promote_type(A,C),a), b, convert(promote_type(A,C),c))

colon{T<:Real}(start::T, step, stop::T) = StepRange(start, step, stop)
colon{T<:Real}(start::T, step::T, stop::T) = StepRange(start, step, stop)
colon{T<:Real}(start::T, step::Real, stop::T) = StepRange(promote(start, step, stop)...)

colon{T}(start::T, step, stop::T) = StepRange(start, step, stop)

Expand Down
7 changes: 6 additions & 1 deletion test/ranges.jl
Original file line number Diff line number Diff line change
Expand Up @@ -388,4 +388,9 @@ for (thisx, thisy) in zip(x, y)
@test thisx == xy[i+=1]
@test thisy == xy[i+=1]
end
end
end

# issue #9962
@test eltype(0:1//3:10) <: Rational
@test (0:1//3:10)[1] == 0
@test (0:1//3:10)[2] == 1//3

0 comments on commit c42ff2d

Please sign in to comment.