Interpolating an `Expr` containing `SSAValue`s/`Slot`s into another `Expr`

Anyone know a way to interpolate an Expr containing SSAValues/Slots into another expression? Something like

julia> @eval Main ans = $(QuoteNode(code_typed(cos, (Float64, ))[1][1].code[50]))
ERROR: syntax: SSAValue objects should not occur in an AST

except without the error?

Note that the original poster on Slack cannot see your response here on Discourse. Consider transcribing the appropriate answer back to Slack, or pinging the poster here on Discourse so they can follow this thread.
(Original message :slack:) (More Info)

This is a Julia issue. Should be fixed by allow quoted ssa values and slots in ast by simeonschaub · Pull Request #39965 · JuliaLang/julia · GitHub.

2 Likes