Skip to content

SIGSEGV and StackOverflow from dispatching on ::Type{T}, ::Array{Union{T,Missing},N}) #36185

@oxinabox

Description

@oxinabox

EDIT: MWE from below

 julia> typeintersect((Tuple{Type{T},Array{Union{T,Missing},N}} where {T,N}),
                     (Tuple{Type{T},Array{Union{T,Nothing},N}} where {T,N}))
ERROR: StackOverflowError

Original text:

If I do

for U in (:(Union{T, Missing}), :(Union{T, Nothing}),)
    @eval function bar(::Type{T}, xs::Array{$U,N}) where {T,N}
        T
    end
end

Then julia SIGSEGV's (Address boundary error)

When I do:

@eval function bazz(::Type{T}, xs::Array{Union{T,Missing},N}) where {T,N}
   T
end

I get a StackOverflowError

When I do:

function bazz(::Type{T}, xs::Array{Union{T,Missing},N}) where {T,N}
   T
end

I am back to crashing out with SIGSEGV's (Address boundary error)

But if i do:

function bazz(::Type{<:T},xs::Array{Union{T,Missing},N}) where {T,N}
   T
end

then it is fine.
But that is a different expression

as is

function bazz(::Type{T},xs::Array{<:Union{T,Missing},N}) where {T,N}
   T
end

This is on Version 1.6.0-DEV.184 (2020-06-06)

Metadata

Metadata

Assignees

No one assigned

    Labels

    types and dispatchTypes, subtyping and method dispatch

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions