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
It seems like constant propagation is affected by a vararg, even if typed to ::Vararg{Any,N} which I would expect to force specialization via this page of the docs.
call1(f::F, x, y) where {F} =f(x, y)
call2(f::F, x, y...) where {F} =f(x, y...)
call3(f::F, x, y::Vararg{Any,N}) where {F,N} =f(x, y...)
g1(a) =call1(isa, a, Int) ? a :0g2(a) =call2(isa, a, Int) ? a :0g3(a) =call3(isa, a, Int) ? a :0
Constant propagation only happens through call1, but call2 and call3 block it:
julia> Base.return_types(g1, (Any,))
1-element Vector{Any}:
Int64
julia> Base.return_types(g2, (Any,))
1-element Vector{Any}:
Any
julia> Base.return_types(g3, (Any,))
1-element Vector{Any}:
Any
The text was updated successfully, but these errors were encountered:
(Is there any general way to force specialisation for a Vararg which includes types? There is this but it seems to only work if all the Vararg is types)
It seems like constant propagation is affected by a vararg, even if typed to
::Vararg{Any,N}
which I would expect to force specialization via this page of the docs.Constant propagation only happens through
call1
, butcall2
andcall3
block it:The text was updated successfully, but these errors were encountered: