MWE on Julia 0.6, OSX x64 binary release; let me know if I should file a bug report. Seems as if the type of u0
should be easy to infer.
init(f, x) = f.(x)
function test(f, nx)
x = linspace(0., 1., nx)
u = init(f, x)
u0 = u[1:nx-1]::Array{Float64, 1}
return u0
end
@code_warntype test(sin, 10)
results in
Variables:
#self#::#test
f::Base.#sin
nx::Int64
x::StepRangeLen{Float64,Base.TwicePrecision{Float64},Base.TwicePrecision{Float64}}
u::Array{Float64,1}
u0::ANY
etc.
(full @code_warntype
output here)