From 458c832428c6b79084f9b4e02ebe0905eb560b84 Mon Sep 17 00:00:00 2001 From: Jeff Bezanson Date: Tue, 16 Aug 2016 15:24:10 -0400 Subject: [PATCH] fix #10633, remove redundant definitions for `map(Integer, a)` etc. (cherry picked from commit 90753676b686fc8d3511a9b6112f3054ec0320f7) ref #18062 --- base/abstractarray.jl | 4 ---- test/functional.jl | 4 ++++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/base/abstractarray.jl b/base/abstractarray.jl index d7fee32340826..fbecc43efa4f8 100644 --- a/base/abstractarray.jl +++ b/base/abstractarray.jl @@ -717,10 +717,6 @@ of_indices(x, y) = similar(dims->y, oftype(indices(x), indices(y))) 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) - ## range conversions ## map{T<:Real}(::Type{T}, r::StepRange) = T(r.start):T(r.step):T(last(r)) diff --git a/test/functional.jl b/test/functional.jl index 5ed8f3ce51db8..4b8db1d0af750 100644 --- a/test/functional.jl +++ b/test/functional.jl @@ -32,6 +32,10 @@ end # maps of strings (character arrays) -- string.jl @test map((c)->Char(c+1), "abcDEF") == "bcdEFG" +# issue #10633 +@test isa(map(Integer, Any[1, 2]), Vector{Int}) +@test isa(map(Integer, Any[]), Vector{Integer}) + # filter -- array.jl @test isequal(filter(x->(x>1), [0 1 2 3 2 1 0]), [2, 3, 2]) # TODO: @test_throws isequal(filter(x->x+1, [0 1 2 3 2 1 0]), [2, 3, 2])