thanks to everyone who commented.
Here is the first case, where ::Any
desapper once you put the call to the function
module MyTest
using PartialWaveFunctions
Psi(L,M,cosθ,ϕ) = sqrt((2L+1)/(2π))*wignerd(L,M,0,cosθ)*sin(M*ϕ)
recamp(cosθ,ϕ,amps,LMs) = sum(a*Psi(L,M,cosθ,ϕ) for (a, (L, M)) in zip(amps,LMs))
export recamp, Psi
end
#
using .MyTest
const testLM = [(L=1, M=1), (L=3,M=1)]
const testA = rand(Complex{Float64},2)
#
@code_warntype Psi(3,1,0.3,0.3) # ::Float64
recamp(0.3,0.3,testA,testLM)
@code_warntype recamp(0.3,0.3,testA,testLM) # ::Any
#
function test()
return recamp(0.3,0.3,testA,testLM)
end
@code_warntype test() # Body::Float64
PartialWaveFunctions
is my package (registered), so it might have something to do with it.
If I replace PartialWaveFunctions.wignerd(L,M,0,cosθ)
with SpecialFunctions.gamma(L*cosθ)
(just for a check), the problem with ::Any
does not show up.