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

AssertionError in show for Vector{Pair{Int64,Vector{Float64}}} #27324

Closed
tkoolen opened this issue May 30, 2018 · 5 comments
Closed

AssertionError in show for Vector{Pair{Int64,Vector{Float64}}} #27324

tkoolen opened this issue May 30, 2018 · 5 comments
Labels
display and printing Aesthetics and correctness of printed representations of objects.

Comments

@tkoolen
Copy link
Contributor

tkoolen commented May 30, 2018

julia> [1 => rand(3)]
1-element Array{Pair{Int64,Array{Float64,1}},1}:
Error showing value of type Array{Pair{Int64,Array{Float64,1}},1}:
ERROR: AssertionError: Array{Float64,1} is not a subtype of Pair{Int64,Array{Float64,1}}
Stacktrace:
 [1] typeinfo_prefix(::IOContext{Base.GenericIOBuffer{Array{UInt8,1}}}, ::Array{Float64,1}) at ./arrayshow.jl:477
 [2] show_vector(::IOContext{Base.GenericIOBuffer{Array{UInt8,1}}}, ::Array{Float64,1}, ::Char, ::Char) at ./arrayshow.jl:431 (repeats 2 times)
 [3] show at ./arrayshow.jl:417 [inlined]
 [4] show(::IOContext{Base.GenericIOBuffer{Array{UInt8,1}}}, ::Pair{Int64,Array{Float64,1}}) at ./show.jl:585
 [5] #sprint#336(::IOContext{REPL.Terminals.TTYTerminal}, ::Int64, ::Function, ::Function, ::Pair{Int64,Array{Float64,1}}) at ./strings/io.jl:97
 [6] #sprint at ./<missing>:0 [inlined]
 [7] alignment(::IOContext{REPL.Terminals.TTYTerminal}, ::Pair{Int64,Array{Float64,1}}) at ./show.jl:1801
 [8] alignment(::IOContext{REPL.Terminals.TTYTerminal}, ::Array{Pair{Int64,Array{Float64,1}},1}, ::Base.OneTo{Int64}, ::Base.OneTo{Int64}, ::Int64, ::Int64, ::Int64) at ./arrayshow.jl:68
 [9] print_matrix(::IOContext{REPL.Terminals.TTYTerminal}, ::Array{Pair{Int64,Array{Float64,1}},1}, ::String, ::String, ::String, ::String, ::String, ::String, ::Int64, ::Int64) at ./arrayshow.jl:186
 [10] print_matrix at ./arrayshow.jl:159 [inlined]
 [11] print_array at ./arrayshow.jl:308 [inlined]
 [12] show(::IOContext{REPL.Terminals.TTYTerminal}, ::MIME{Symbol("text/plain")}, ::Array{Pair{Int64,Array{Float64,1}},1}) at ./arrayshow.jl:344
 [13] display(::REPL.REPLDisplay{REPL.LineEditREPL}, ::MIME{Symbol("text/plain")}, ::Array{Pair{Int64,Array{Float64,1}},1}) at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v0.7/REPL/src/REPL.jl:130
 [14] display(::REPL.REPLDisplay{REPL.LineEditREPL}, ::Array{Pair{Int64,Array{Float64,1}},1}) at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v0.7/REPL/src/REPL.jl:133
 [15] display(::Array{Pair{Int64,Array{Float64,1}},1}) at ./multimedia.jl:287
 [16] #invokelatest#1 at ./essentials.jl:667 [inlined]
 [17] invokelatest at ./essentials.jl:666 [inlined]
 [18] print_response(::REPL.Terminals.TTYTerminal, ::Any, ::Nothing, ::Bool, ::Bool, ::Nothing) at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v0.7/REPL/src/REPL.jl:151
 [19] print_response(::REPL.LineEditREPL, ::Any, ::Nothing, ::Bool, ::Bool) at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v0.7/REPL/src/REPL.jl:137
 [20] (::getfield(REPL, Symbol("#do_respond#42")){Bool,getfield(REPL, Symbol("##52#61")){REPL.LineEditREPL,REPL.REPLHistoryProvider},REPL.LineEditREPL,REPL.LineEdit.Prompt})(::REPL.LineEdit.MIState, ::Base.GenericIOBuffer{Array{UInt8,1}}, ::Bool) at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v0.7/REPL/src/REPL.jl:705
 [21] top-level scope
julia> versioninfo()
Julia Version 0.7.0-DEV.5245
Commit fb0d289814 (2018-05-29 12:44 UTC)
Platform Info:
  OS: macOS (x86_64-apple-darwin14.5.0)
  CPU: Intel(R) Core(TM) i7-3820QM CPU @ 2.70GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.0 (ORCJIT, ivybridge)
@KristofferC
Copy link
Member

KristofferC commented May 30, 2018

#25466, #26881, #26256, #25042, not saying this is an exact dup but something is just not good with the way things are done now

@fredrikekre fredrikekre added the display and printing Aesthetics and correctness of printed representations of objects. label May 30, 2018
@JeffBezanson
Copy link
Member

Would be fixed by #26602; only question is how many more of those PRs will be needed over the years...

@StefanKarpinski
Copy link
Member

There's definitely something rotten about this approach that we need to fix. I have noted it in my collection of potentially unstable APIs document.

@JeffBezanson
Copy link
Member

My analysis and suggested fix:
#25857 (comment)
#26881 (comment)

@JeffBezanson
Copy link
Member

Actually this does seem to be an exact dup of #25466.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
display and printing Aesthetics and correctness of printed representations of objects.
Projects
None yet
Development

No branches or pull requests

5 participants