Type inference of sum result

Is there a reason way @code_warntype shows the output of sum(m::Vector{Float64}) to be Any instead of Float64? (Julia 0.5.0 commit 3c9d753) Is It a bug? Best

julia> const m = rand(200);

julia> @code_warntype sum(m)
Variables:
  #self#::Base.#sum
  a::Array{Float64,1}

Body:
  begin 
      return $(Expr(:invoke, LambdaInfo for _mapreduce(::Base.#identity, ::Base.#+, ::Base.LinearFast, ::Array{Float64,1}), :(Base._mapreduce), :(Base.identity), :(Base.+), :($(Expr(:new, :(Base.LinearFast)))), :(a)))
  end::Any

julia> sum(m)
106.64239553853307

It looks like it has been fixed in the 0.5 release.

1 Like

Thanks! It’s solved in Julia 0.5.0 :slight_smile: