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

Display error if struct contains LabelledArray with mixed types #46

Open
jishnub opened this issue Feb 19, 2019 · 0 comments
Open

Display error if struct contains LabelledArray with mixed types #46

jishnub opened this issue Feb 19, 2019 · 0 comments

Comments

@jishnub
Copy link

jishnub commented Feb 19, 2019

Struct does not get displayed if it contains a labelled array with mixed types.

julia> using LabelledArrays

julia> T = @SLVector (:x,:y,:z)
SLArray{Tuple{3},1,(:x, :y, :z),T} where T

julia> T(1,2,3.4)
3-element SLArray{Tuple{3},1,(:x, :y, :z),Real}:
 1  
 2  
 3.4

julia> [typeof(x) for x in T(1,2,3.4)]
3-element StaticArrays.SizedArray{Tuple{3},DataType,1,1}:
 Int64  
 Int64  
 Float64

julia> struct H
       var :: T
       end

julia> a=H(T(1,2,3.4))
H(Error showing value of type H:
ERROR: MethodError: Cannot `convert` an object of type LabelledArrays.DisplayCell{Int64} to an object of type LabelledArrays.DisplayCell{Real}
Closest candidates are:
  convert(::Type{T}, ::T) where T at essentials.jl:154
  LabelledArrays.DisplayCell{Real}(::Any, ::Any) where T at /home/user/.julia/packages/LabelledArrays/Y2gSe/src/display.jl:2
Stacktrace:
 [1] setindex!(::Array{LabelledArrays.DisplayCell{Real},1}, ::LabelledArrays.DisplayCell{Int64}, ::Int64) at ./array.jl:767
 [2] show(::IOContext{REPL.Terminals.TTYTerminal}, ::SLArray{Tuple{3},1,(:x, :y, :z),Real}) at /home/user/.julia/packages/LabelledArrays/Y2gSe/src/display.jl:22
 [3] show_default(::IOContext{REPL.Terminals.TTYTerminal}, ::Any) at ./show.jl:332
 [4] show at ./show.jl:315 [inlined]
 [5] show(::IOContext{REPL.Terminals.TTYTerminal}, ::MIME{Symbol("text/plain")}, ::H) at ./sysimg.jl:194
 [6] display(::REPL.REPLDisplay, ::MIME{Symbol("text/plain")}, ::Any) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/REPL/src/REPL.jl:131
 [7] display(::REPL.REPLDisplay, ::Any) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/REPL/src/REPL.jl:135
 [8] display(::Any) at ./multimedia.jl:287
 [9] #invokelatest#1 at ./essentials.jl:742 [inlined]
 [10] invokelatest at ./essentials.jl:741 [inlined]
 [11] print_response(::IO, ::Any, ::Any, ::Bool, ::Bool, ::Any) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/REPL/src/REPL.jl:155
 [12] print_response(::REPL.AbstractREPL, ::Any, ::Any, ::Bool, ::Bool) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/REPL/src/REPL.jl:140
 [13] (::getfield(REPL, Symbol("#do_respond#38")){Bool,getfield(REPL, Symbol("##48#57")){REPL.LineEditREPL,REPL.REPLHistoryProvider},REPL.LineEditREPL,REPL.LineEdit.Prompt})(::Any, ::Any, ::Any) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/REPL/src/REPL.jl:714
 [14] #invokelatest#1 at ./essentials.jl:742 [inlined]
 [15] invokelatest at ./essentials.jl:741 [inlined]
 [16] run_interface(::REPL.Terminals.TextTerminal, ::REPL.LineEdit.ModalInterface, ::REPL.LineEdit.MIState) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/REPL/src/LineEdit.jl:2273
 [17] run_frontend(::REPL.LineEditREPL, ::REPL.REPLBackendRef) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/REPL/src/REPL.jl:1035
 [18] run_repl(::REPL.AbstractREPL, ::Any) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/REPL/src/REPL.jl:192
 [19] (::getfield(Base, Symbol("##734#736")){Bool,Bool,Bool,Bool})(::Module) at ./client.jl:362
 [20] #invokelatest#1 at ./essentials.jl:742 [inlined]
 [21] invokelatest at ./essentials.jl:741 [inlined]
 [22] run_main_repl(::Bool, ::Bool, ::Bool, ::Bool, ::Bool) at ./client.jl:346
 [23] exec_options(::Base.JLOptions) at ./client.jl:284
 [24] _start() at ./client.jl:436
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant