# Inconsistent \`@code\_warntype\` and \`@inferred\`

**URL:** <https://discourse.julialang.org/t/inconsistent-code-warntype-and-inferred/24998>\
**Category:** General Usage\
**Created:** [June 6, 2019, 8:39am UTC](https://discourse.julialang.org/t/inconsistent-code-warntype-and-inferred/24998 "2019-06-06T08:39:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jw3126](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jw3126/32/3086_2.png) [@jw3126](https://discourse.julialang.org/u/jw3126)\
**Post date:** [June 6, 2019, 8:39am UTC](https://discourse.julialang.org/t/inconsistent-code-warntype-and-inferred/24998/1 "2019-06-06T08:39:46Z")

</div>

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

```julia
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?

---

<div class="post-metadata">

**Author:** ![tkf](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tkf/32/17635_2.png) [@tkf](https://discourse.julialang.org/u/tkf)\
**Post date:** [July 7, 2019, 3:47am UTC](https://discourse.julialang.org/t/inconsistent-code-warntype-and-inferred/24998/2 "2019-07-07T03:47:19Z")

</div>

Same issue here: [https://github.com/tkf/Transducers.jl/issues/14](https://github.com/tkf/Transducers.jl/issues/14)

---

<div class="post-metadata">

**Author:** ![tkf](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tkf/32/17635_2.png) [@tkf](https://discourse.julialang.org/u/tkf)\
**Post date:** [July 29, 2019, 1:15am UTC](https://discourse.julialang.org/t/inconsistent-code-warntype-and-inferred/24998/3 "2019-07-29T01:15:07Z")

</div>

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

[![](https://global.discourse-cdn.com/julialang/original/3X/d/2/d205f0b654c3c084ba11e1aadc3df08966a45929.jpeg "JuliaCon 2019 | Static walks through dynamic programs | Valentin Churavy") ](https://www.youtube.com/watch?v=qf9oA09wxXY&t=1376)

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