Inconsistent `@code_warntype` and `@inferred`

I have a function that has good looking @code_warntype but @inferred fails:

julia> @inferred waterdose(int, pts, ncase=ncase)
ERROR: return type Array{UncertaintyPropagation.Errorful{Float64},1} does not match inferred return type Any
Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] top-level scope at none:0

julia> @code_warntype waterdose(int, pts, ncase=ncase) # looks good
Body::Array{UncertaintyPropagation.Errorful{Float64},1}
...

Is this a known phenomenon?

3 Likes

Same issue here: https://github.com/tkf/Transducers.jl/issues/14

2 Likes

Maybe it’s related to what @vchuravy is talking about in the Q&A of his talk

? Does it mean @inferred uses inference cache but @code_warntype doesn’t?