Skip to content

Type parameter corrupted when matching #25240

@alyst

Description

@alyst

This should be the more confined example of the bug that hit JuliaData/WeakRefStrings.jl#20 on Julia nightly (Julia 0.7.0-DEV.3018):

julia> foo(A::Array{T}) where {T} = @show T eltype(A)
foo (generic function with 1 method)

julia> bar(A::Array{T}) where {T <: Union{Integer, Missing}} = @show T eltype(A)
bar (generic function with 1 method)

julia> bar2(A::Array{T}) where {T <: Union{Int, Missing}} = @show T eltype(A)
bar2 (generic function with 1 method)

julia> foo([1, missing])
T = Union{Missing, Int64}
eltype(A) = Union{Missing, Int64}
Union{Missing, Int64}

julia> bar([1, missing])
T = Int64
eltype(A) = Union{Missing, Int64}
Union{Missing, Int64}

julia> bar2([1, missing])
T = Union{Missing, Int64}
eltype(A) = Union{Missing, Int64}
Union{Missing, Int64}

For some reason T===Int instead of T=Union{Int, Missing} inside bar().

Metadata

Metadata

Assignees

No one assigned

    Labels

    missing dataBase.missing and related functionalitytypes 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