Introspection on comprehension expressions

Hello, somehow I cannot introspect (@code_lowered, @code_warntype, …) on comprehension expressions. Is it somehow possible to achieve?

E. g.:

julia> A = [1,2,3,4,5];

julia> @code_lowered [a^2 for a in A]
ERROR: expression is not a function call, or is too complex for @code_lowered to analyze; break it down to simpler parts if possible

Thanks…

P. S. it would be ok for me to at least know how comprehensions are lowered compared to map and filter.

Perhaps you are looking for Meta.@lower [a^2 for a in A].

Yeah, that was what I was searching for, any reason it is not possible with standard @code_lowered?

If you put the comprehension in a function and inspect the lowered code of that is should work

1 Like