Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type parameter corrupted when matching #25240

Closed
alyst opened this issue Dec 22, 2017 · 2 comments · Fixed by #26691
Closed

Type parameter corrupted when matching #25240

alyst opened this issue Dec 22, 2017 · 2 comments · Fixed by #26691
Labels
domain:missing data Base.missing and related functionality domain:types and dispatch Types, subtyping and method dispatch

Comments

@alyst
Copy link
Contributor

alyst commented Dec 22, 2017

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().

@JeffBezanson JeffBezanson added the domain:types and dispatch Types, subtyping and method dispatch label Dec 22, 2017
@nalimilan
Copy link
Member

Sounds similar to the bug signalled at #24653 (comment), which has a @test_broken call.

@nalimilan nalimilan added the domain:missing data Base.missing and related functionality label Dec 22, 2017
@alyst
Copy link
Contributor Author

alyst commented Dec 22, 2017

Actually, if Missing is replaced with Float64 and the functions are called like foo(Union{Int, Float64}[1, 1.5]) the bug is still there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain:missing data Base.missing and related functionality domain:types and dispatch Types, subtyping and method dispatch
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants