Skip to content

Commit

Permalink
fix map! Integer over Any JuliaLang#10633
Browse files Browse the repository at this point in the history
  • Loading branch information
hayd committed Mar 26, 2015
1 parent c4b5397 commit 4611263
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions base/abstractarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -376,9 +376,10 @@ end

full(x::AbstractArray) = x

map(::Type{Integer}, a::Array) = map!(Integer, similar(a,typeof(Integer(one(eltype(a))))), a)
map(::Type{Signed}, a::Array) = map!(Signed, similar(a,typeof(Signed(one(eltype(a))))), a)
map(::Type{Unsigned}, a::Array) = map!(Unsigned, similar(a,typeof(Unsigned(one(eltype(a))))), a)
function map{T <: Integer}(::Type{T}, a::Array)
Ta = (t = eltype(a); method_exists(one, (t,)) ? typeof(T(one(t))) : T)
map!(T, similar(a, Ta, a))
end

## range conversions ##

Expand Down

0 comments on commit 4611263

Please sign in to comment.