Unknown warntype from Expr()

the following function:

function symident(n::Int)
    rows = Vector{Expr}(undef, n)
    temp = zeros(Int, n)
    for i in Base.OneTo(n)
        temp[i] = 1
        rows[i] = Expr(:row, temp...)
        temp[i] = 0

    return Expr(:vcat, rows...)

gives warntypes that I don’t understand:

julia> @code_warntype symident(3)
│   %23 = Core._apply(Main.Expr, %22, temp)::Any
│   %32 = Core._apply(Main.Expr, %31, rows)::Any
└──       return %32

seems like there’s some problem using the splatting operator ... ?
please help. thanks.

minimal working examples:

f1() = (v = [:a, :b]; Expr(:row, v...) )
f2() = (v = [Expr(:call, :+, 1, 1), Expr(:call, :+, 2, 2)]; 
        Expr(:row, v...) )
f3() = (v = [1, 2]; Expr(:row, v...) )
f4() = (v = [1, 2]; Expr(:vcat, v...) )

julia> @code_warntype f1()
julia> @code_warntype f2()
julia> @code_warntype f3()
julia> @code_warntype f4()

all functions f1() to f4() give warntypes.

I am not sure what you are expecting here, since Expr has its args in a Vector{Any}:

julia> dump(Expr)
Expr <: Any

Since the primary use case for manipulating Exprs is metaprogramming, this is intentional.

oh, I supposed that args should be, e.g. in Vector{Int} for f4().

that said, does those warntypes has performance overhead? or, could I just ignore all warntypes involving expressions and symbols? thanks.

Compared to what?

Possibly yes, but if your use case is metaprogramming, they should be irrelevant anyway.

Are you optimizing metaprogramming code? Having some context would help.

I’m trying to use Reduce.jl to help generating some complicated equations (that I could not completed by hands). Anyway, I think the warntype overhead is very small compared to those used in working with the REDUCE CSL.