Warntype from anonymous function

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. :pray:

const anonymous = ...

2 Likes