Skip to content

Commit

Permalink
Remove invalid anonymous function in broadcast_tup
Browse files Browse the repository at this point in the history
  • Loading branch information
pabloferz committed Sep 19, 2016
1 parent 2193638 commit e4eafbc
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions base/broadcast.jl
Original file line number Diff line number Diff line change
Expand Up @@ -255,18 +255,16 @@ end

@inline broadcast_t(f, T, As...) = broadcast!(f, similar(Array{T}, broadcast_indices(As...)), As...)

@generated function broadcast_tup{AT,nargs}(f, As::AT, ::Type{Val{nargs}}, n)
quote
ntuple(n -> (@ncall $nargs f i->_broadcast_getindex(As[i], n)), Val{n})
end
@generated function broadcast_tup{AT,nargs,n}(f, As::AT, ::Type{Val{nargs}}, ::Type{Val{n}})
Expr(:tuple, (Expr(:call, :f, (:(_broadcast_getindex(As[$i], $k)) for i=1:nargs)...) for k=1:n)...)
end

function broadcast_c(f, ::Type{Tuple}, As...)
shape = broadcast_indices(As...)
check_broadcast_indices(shape, As...)
n = length(shape[1])
nargs = length(As)
return broadcast_tup(f, As, Val{nargs}, n)
return broadcast_tup(f, As, Val{nargs}, Val{n})
end
@inline broadcast_c(f, ::Type{Any}, a...) = f(a...)
@inline broadcast_c(f, ::Type{Array}, As...) = broadcast_t(f, promote_eltype_op(f, As...), As...)
Expand Down

0 comments on commit e4eafbc

Please sign in to comment.