I would expect that it could resolve it, not that the code inference
for that has necessarily been written. In your first example, it is
not provable (without additional assumptions) that the global
represented by f will not change, and thus Vector{Any} is the best
possible result.

If you care about the type of the result, then use a typed
comprehension: `Int[f(x) for x in [1,2,3]]`. A generalized
comprehension is (by definition) allowed to return any array type it
wants (but typically tries to pick something fast).


This
[(function(x) x; end)(x) for x in [1,2,3]]
 seems like a very complicated way of writing
this
[x for x in 1:3]

Reply via email to