Skip to content

Commit

Permalink
Merge b6e6ad5 into 03c2464
Browse files Browse the repository at this point in the history
  • Loading branch information
pabloferz authored Nov 25, 2016
2 parents 03c2464 + b6e6ad5 commit eaf0589
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
9 changes: 5 additions & 4 deletions base/broadcast.jl
Original file line number Diff line number Diff line change
Expand Up @@ -259,11 +259,12 @@ end

ftype(f, A) = typeof(f)
ftype(f, A...) = typeof(a -> f(a...))
ftype(T::DataType, A) = Type{T}
ftype(T::DataType, A...) = Type{T}
ftype(T::Type, A) = Type{T}
ftype(T::Type, A...) = Type{T}
ziptype(A) = Tuple{eltype(A)}
ziptype(A, B) = Iterators.Zip2{Tuple{eltype(A)}, Tuple{eltype(B)}}
@inline ziptype(A, B, C, D...) = Iterators.Zip{Tuple{eltype(A)}, ziptype(B, C, D...)}
ziptype(T::Type) = Tuple{Type{T}}
ziptype(A, B) = Iterators.Zip2{ziptype(A), ziptype(B)}
@inline ziptype(A, B, C, D...) = Iterators.Zip{ziptype(A), ziptype(B, C, D...)}

# broadcast methods that dispatch on the type of the final container
@inline function broadcast_c(f, ::Type{Array}, As...)
Expand Down
3 changes: 3 additions & 0 deletions test/broadcast.jl
Original file line number Diff line number Diff line change
Expand Up @@ -352,3 +352,6 @@ StrangeType18623(x,y) = (x,y)
# Issue 18622
@test @inferred muladd.([1.0], [2.0], [3.0])::Vector{Float64} == [5.0]
@test @inferred tuple.(1:3, 4:6, 7:9)::Vector{Tuple{Int,Int,Int}} == [(1,4,7), (2,5,8), (3,6,9)]

# 19419
@test broadcast(round, Int, [1])::Vector{Int} == [1]

0 comments on commit eaf0589

Please sign in to comment.