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

Union{}[] cannot be displayed #2351

Closed
BioTurboNick opened this issue Nov 1, 2022 · 1 comment
Closed

Union{}[] cannot be displayed #2351

BioTurboNick opened this issue Nov 1, 2022 · 1 comment
Labels
display & PlutoRunner & AbstractPlutoDingetjes.jl other packages Integration with other Julia packages

Comments

@BioTurboNick
Copy link
Contributor

The following code leads to a display error (see end):

using NearestNeighbors
map([]) do f
	knn(BallTree(), [])
end # Union{}[]

The underlying issue I believe is that since the interior is invalid, type inference is failing, but it's odd that Pluto can't display the result. (Unless this is a Julia bug and this type should never be observed?)

Compared to:

map([]) do f
end # Nothing[]

map([]) do f
    knn(BallTree([1.0; 2.0]), [1.0; 2.0], 1)
end # Any[]
Failed to show value:

MethodError: show(::IOContext{IOBuffer}, ::MIME{Symbol("image/svg+xml")}, ::Vector{Union{}}) is ambiguous. Candidates:

show(io::IO, mime::MIME{Symbol("image/svg+xml")}, cs::AbstractVector{T}; max_swatches) where T<:ColorTypes.TransparentColor in Colors at /home/ec2-user/.julia/packages/Colors/yDxFN/src/display.jl:41

show(io::IO, mime::MIME{Symbol("image/svg+xml")}, cs::AbstractVector{T}; max_swatches) where T<:ColorTypes.Color in Colors at /home/ec2-user/.julia/packages/Colors/yDxFN/src/display.jl:35

Possible fix, define

show(::IO, ::MIME{Symbol("image/svg+xml")}, ::AbstractVector{Union{}})

show_richest(::IOContext{IOBuffer}, ::Any)@PlutoRunner.jl:1143
show_richest_withreturned@PlutoRunner.jl:1068[inlined]
format_output_default(::Any, ::Any)@PlutoRunner.jl:968
var"#format_output#51"(::IOContext{Base.DevNull}, ::typeof(Main.PlutoRunner.format_output), ::Any)@PlutoRunner.jl:985
formatted_result_of(::Base.UUID, ::Base.UUID, ::Bool, ::Vector{String}, ::Nothing, ::Module)@PlutoRunner.jl:878
top-level scope@WorkspaceManager.jl:477
@fonsp
Copy link
Owner

fonsp commented Nov 1, 2022

It looks like this is a Colors.jl issue: JuliaGraphics/Colors.jl#526

@fonsp fonsp closed this as not planned Won't fix, can't repro, duplicate, stale Nov 1, 2022
@fonsp fonsp added other packages Integration with other Julia packages display & PlutoRunner & AbstractPlutoDingetjes.jl labels Nov 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
display & PlutoRunner & AbstractPlutoDingetjes.jl other packages Integration with other Julia packages
Projects
None yet
Development

No branches or pull requests

2 participants