Skip to content

Commit

Permalink
Restrict T[a:b] and T[a:s:b] notation to T <: Number.
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanKarpinski committed Mar 24, 2012
1 parent af508ab commit 9159bd2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion base/array.jl
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ ref{T}(::Type{T}) = Array(T,0)
ref{T}(::Type{T}, x) = (a=Array(T,1); a[1]=x; a)

# T[a:b] and T[a:s:b] also contruct typed ranges
function ref{T}(::Type{T}, r::Ranges)
function ref{T<:Number}(::Type{T}, r::Ranges)
a = Array(T,length(r))
i = 1
for x in r
Expand Down

0 comments on commit 9159bd2

Please sign in to comment.