You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
julia>f() =_apply(call, tuple, (f(x)::Vararg,), (f(y)::Vararg,))
f (generic function with 1 method)
julia>code_typed(f,())
ERROR: Vararg type in non-final position
in abstract_call at ./inference.jl:871in abstract_apply at ./inference.jl:766in abstract_call at ./inference.jl:814in abstract_eval_call at ./inference.jl:901in abstract_eval at ./inference.jl:928in typeinf_uncached at ./inference.jl:1588in typeinf at ./inference.jl:1304in code_typed at inference.jl:3256
this is a reduced test case from a situation that comes up at the end of building the sysimg with --compile=all when trying to precompile the following definition:
functionpromote(x, y, zs...)
# promotion.jl:139
(convert(promote_typeof(x,y,zs...), x),
convert(promote_typeof(x,y,zs...), y),
convert(Tuple{Vararg{promote_typeof(x,y,zs...)}}, zs)...)
end
I suspect that issue may come from inferring that the return values of convert(Tuple{Vararg}, zs)...) is Vararg (rather than Any), although the stacktrace shows that this results from attempting to infer the result type of the following expression:
edit: I realized this can also be triggered directly:
julia>code_typed(promote,(Any,Any,Vararg{Any}))
ERROR: Vararg type in non-final position
in abstract_call at ./inference.jl:871in abstract_apply at ./inference.jl:766in abstract_call at ./inference.jl:814in abstract_eval_call at ./inference.jl:901in abstract_eval at ./inference.jl:928in typeinf_uncached at ./inference.jl:1588in typeinf at ./inference.jl:1304in typeinf at ./inference.jl:1254in abstract_call_gf at ./inference.jl:693in abstract_call at ./inference.jl:837in abstract_apply at ./inference.jl:766in abstract_call at ./inference.jl:814in abstract_eval_call at ./inference.jl:901in abstract_eval at ./inference.jl:928in typeinf_uncached at ./inference.jl:1588in typeinf at ./inference.jl:1304in typeinf at ./inference.jl:1254in abstract_call_gf at ./inference.jl:693in abstract_call at ./inference.jl:837in abstract_eval_call at ./inference.jl:901in abstract_eval at ./inference.jl:928in abstract_eval_call at ./inference.jl:878in abstract_eval at ./inference.jl:928in typeinf_uncached at ./inference.jl:1588in typeinf at ./inference.jl:1304in code_typed at inference.jl:3256
The text was updated successfully, but these errors were encountered:
I also stumbled across this. Here's another test-cases in case that helps:
find_tvar{T<:Tuple}(sig::Type{T}) =1functionfind_tvar(arg)
if arg<:Tuplefind_tvar(arg[random_var_name])
endreturn1endfind_tvar(Vararg{Int}) # errors with above error
Note that this does not errror:
#find_tvar{T<:Tuple}(sig::Type{T}) = 1functionfind_tvar(arg)
if arg<:Tuplefind_tvar(arg[random_var_name])
endreturn1endfind_tvar(Vararg{Int})
and this neither
find_tvar{T<:Tuple}(sig::Type{T}) =1functionfind_tvar(arg)
if arg<:Tuplefind_tvar(arg[1])
endreturn1endfind_tvar(Vararg{Int})
this is a reduced test case from a situation that comes up at the end of building the sysimg with
--compile=all
when trying to precompile the following definition:I suspect that issue may come from inferring that the return values of
convert(Tuple{Vararg}, zs)...)
is Vararg (rather thanAny
), although the stacktrace shows that this results from attempting to infer the result type of the following expression:this in turn came from:
note, these are defined in base as:
finally, that in turn came from part of our original expression:
edit: I realized this can also be triggered directly:
The text was updated successfully, but these errors were encountered: