From 9159bd26acbd1570c4bde2c9581e2e233f302607 Mon Sep 17 00:00:00 2001 From: Stefan Karpinski Date: Sat, 24 Mar 2012 15:22:58 -0400 Subject: [PATCH] Restrict T[a:b] and T[a:s:b] notation to T <: Number. --- base/array.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base/array.jl b/base/array.jl index 241ba3195605d..eb73b693d4857 100644 --- a/base/array.jl +++ b/base/array.jl @@ -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