Type stability problem with NamedTuple of Union{T,Missing}


#1

Does anyone have an idea how to make the following function type-stable?

function extracttuple(a,b,i)
    (a=a[i],b=b[i])
end

a=zeros(Union{Float64,Missing},10)
b=zeros(Union{Float64,Missing},10)
@code_warntype extracttuple(a,b,1)

code_warntype returns Any as a return type, while I would have hoped/expected something like NamedTuple{(:a,:b),Tuple{Union{Missing,Float64},Union{Missing,Float64}}} Any hints or links to already existing issues would be appreciated.


#2

Maybe https://github.com/JuliaLang/julia/issues/29970 is good to track.