QuantumBFS / YaoExtensions.jl

Useful extensions for Yao
Apache License 2.0
9 stars 3 forks source link

PauliString show error #36

Closed PhilipVinc closed 3 years ago

PhilipVinc commented 3 years ago

On 0.2.4 (latest)

julia> using Yao, YaoExtensions

julia> PauliString(X, Y)
nqubits: 2
Error showing value of type PauliString{2, YaoBlocks.ConstGate.PauliGate, StaticArrays.SizedVector{2, YaoBlocks.ConstGate.PauliGate, Vector{YaoBlocks.ConstGate.PauliGate}}}:
ERROR: UndefVarError: color not defined
Stacktrace:
  [1] print_block(io::IOContext{Base.TTY}, x::PauliString{2, YaoBlocks.ConstGate.PauliGate, StaticArrays.SizedVector{2, YaoBlocks.ConstGate.PauliGate, Vector{YaoBlocks.ConstGate.PauliGate}}})
    @ YaoExtensions ~/.julia/packages/YaoExtensions/EGB9f/src/block_extension/pauli_strings.jl:106
  [2] print_tree(io::IOContext{Base.TTY}, root::PauliString{2, YaoBlocks.ConstGate.PauliGate, StaticArrays.SizedVector{2, YaoBlocks.ConstGate.PauliGate, Vector{YaoBlocks.ConstGate.PauliGate}}}, node::PauliString{2, YaoBlocks.ConstGate.PauliGate, StaticArrays.SizedVector{2, YaoBlocks.ConstGate.PauliGate, Vector{YaoBlocks.ConstGate.PauliGate}}}, depth::Int64, islast::Bool, active_levels::Tuple{}; maxdepth::Int64, charset::YaoBlocks.BlockTreeCharSet, title::Bool, compact::Bool)
    @ YaoBlocks ~/.julia/packages/YaoBlocks/TIlDJ/src/layout.jl:101
  [3] print_tree (repeats 2 times)
    @ ~/.julia/packages/YaoBlocks/TIlDJ/src/layout.jl:92 [inlined]
  [4] #print_tree#141
    @ ~/.julia/packages/YaoBlocks/TIlDJ/src/layout.jl:66 [inlined]
  [5] print_tree
    @ ~/.julia/packages/YaoBlocks/TIlDJ/src/layout.jl:66 [inlined]
  [6] show(io::IOContext{Base.TTY}, #unused#::MIME{Symbol("plain/text")}, blk::PauliString{2, YaoBlocks.ConstGate.PauliGate, StaticArrays.SizedVector{2, YaoBlocks.ConstGate.PauliGate, Vector{YaoBlocks.ConstGate.PauliGate}}})
    @ YaoBlocks ~/.julia/packages/YaoBlocks/TIlDJ/src/layout.jl:56
  [7] show(io::IOContext{Base.TTY}, m::String, x::PauliString{2, YaoBlocks.ConstGate.PauliGate, StaticArrays.SizedVector{2, YaoBlocks.ConstGate.PauliGate, Vector{YaoBlocks.ConstGate.PauliGate}}})
    @ Base.Multimedia ./multimedia.jl:111
  [8] show
    @ ~/.julia/packages/YaoBlocks/TIlDJ/src/layout.jl:55 [inlined]
  [9] show(io::IOContext{Base.TTY}, #unused#::MIME{Symbol("text/plain")}, x::PauliString{2, YaoBlocks.ConstGate.PauliGate, StaticArrays.SizedVector{2, YaoBlocks.ConstGate.PauliGate, Vector{YaoBlocks.ConstGate.PauliGate}}})
    @ Base.Multimedia ./multimedia.jl:47
 [10] (::REPL.var"#38#39"{REPL.REPLDisplay{REPL.LineEditREPL}, MIME{Symbol("text/plain")}, Base.RefValue{Any}})(io::Any)
    @ REPL /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/REPL/src/REPL.jl:220
 [11] with_repl_linfo(f::Any, repl::REPL.LineEditREPL)
    @ REPL /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/REPL/src/REPL.jl:462
 [12] display(d::REPL.REPLDisplay, mime::MIME{Symbol("text/plain")}, x::Any)
    @ REPL /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/REPL/src/REPL.jl:213
 [13] display(d::REPL.REPLDisplay, x::Any)
    @ REPL /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/REPL/src/REPL.jl:225
 [14] display(x::Any)
    @ Base.Multimedia ./multimedia.jl:328
 [15] #invokelatest#2
    @ ./essentials.jl:708 [inlined]
 [16] invokelatest
    @ ./essentials.jl:706 [inlined]
 [17] print_response(errio::IO, response::Any, show_value::Bool, have_color::Bool, specialdisplay::Union{Nothing, AbstractDisplay})
    @ REPL /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/REPL/src/REPL.jl:247
 [18] (::REPL.var"#40#41"{REPL.LineEditREPL, Pair{Any, Bool}, Bool, Bool})(io::Any)
    @ REPL /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/REPL/src/REPL.jl:231
 [19] with_repl_linfo(f::Any, repl::REPL.LineEditREPL)
    @ REPL /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/REPL/src/REPL.jl:462
 [20] print_response(repl::REPL.AbstractREPL, response::Any, show_value::Bool, have_color::Bool)
    @ REPL /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/REPL/src/REPL.jl:229
 [21] (::REPL.var"#do_respond#61"{Bool, Bool, REPL.var"#72#82"{REPL.LineEditREPL, REPL.REPLHistoryProvider}, REPL.LineEditREPL, REPL.LineEdit.Prompt})(s::REPL.LineEdit.MIState, buf::Any, ok::Bool)
    @ REPL /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/REPL/src/REPL.jl:798
 [22] #invokelatest#2
    @ ./essentials.jl:708 [inlined]
 [23] invokelatest
    @ ./essentials.jl:706 [inlined]
 [24] run_interface(terminal::REPL.Terminals.TextTerminal, m::REPL.LineEdit.ModalInterface, s::REPL.LineEdit.MIState)
    @ REPL.LineEdit /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/REPL/src/LineEdit.jl:2441
 [25] run_frontend(repl::REPL.LineEditREPL, backend::REPL.REPLBackendRef)
    @ REPL /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/REPL/src/REPL.jl:1126
 [26] (::REPL.var"#44#49"{REPL.LineEditREPL, REPL.REPLBackendRef})()
    @ REPL ./task.jl:411