From e4eafbc429f3f43cc5172f7d6c4d66a5ce9e3bf5 Mon Sep 17 00:00:00 2001 From: pabloferz Date: Mon, 19 Sep 2016 16:21:48 +0200 Subject: [PATCH] Remove invalid anonymous function in broadcast_tup --- base/broadcast.jl | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/base/broadcast.jl b/base/broadcast.jl index d6801a7e074b4f..7c32baebd56b9c 100644 --- a/base/broadcast.jl +++ b/base/broadcast.jl @@ -255,10 +255,8 @@ 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...) @@ -266,7 +264,7 @@ function broadcast_c(f, ::Type{Tuple}, 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...)