# Warntype from anonymous function

**URL:** <https://discourse.julialang.org/t/warntype-from-anonymous-function/34975>\
**Category:** General Usage\
**Created:** [February 21, 2020, 1:09pm UTC](https://discourse.julialang.org/t/warntype-from-anonymous-function/34975 "2020-02-21T13:09:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tomtom](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tomtom/32/5106_2.png) [@tomtom](https://discourse.julialang.org/u/tomtom)\
**Post date:** [February 21, 2020, 1:09pm UTC](https://discourse.julialang.org/t/warntype-from-anonymous-function/34975/1 "2020-02-21T13:09:08Z")

</div>

```julia
anonymous = (x -> 2x)
callanonymous(a) = anonymous(a)

normal(x) = 2x
callnormal(a) = normal(a)

julia> @code_warntype callanonymous(1)
Body::Any
1 ─ %1 = Main.anonymous(a)::Any
└── return %1

julia> @code_warntype anonymous(1) # fine

julia> @code_warntype callnormal(1) # fine

julia> @code_warntype normal(1) # fine

```

when I try to call an anonymous function inside another function, warntype caused. However, directly calling the anonymous function has no warntype!  
is there any work around to avoid the warntype? thanks. 🙏

---

<div class="post-metadata">

**Author:** ![yuyichao](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yuyichao/32/20_2.png) [@yuyichao](https://discourse.julialang.org/u/yuyichao)\
**Post date:** [February 21, 2020, 1:23pm UTC](https://discourse.julialang.org/t/warntype-from-anonymous-function/34975/2 "2020-02-21T13:23:02Z")

</div>

> [@tomtom](#):
>
> anonymous = (x → 2x)

`const anonymous = ...`
