Skip to content

Labelled slice fails in Julia 1.4.0 #83

Description

@dutille

Hi,

When trying the examples of Labelled slices given here:
https://github.com/SciML/LabelledArrays.jl

I get errors. Here is how it goes:

julia> ABC = @SLSliced (3,2) (:a,:b,:c), (:x, :y)
SLArray{Tuple{3,2},Tuple{(:a, :b, :c),(:x, :y)},N,L,Syms} where Syms where L where N

julia> A = ABC([1 2; 3 4; 5 6])
3×2 SLArray{Tuple{3,2},Int64,2,6,Tuple{(:a, :b, :c),(:x, :y)}} with indices SOneTo(3)×SOneTo(2):
Error showing value of type SLArray{Tuple{3,2},Int64,2,6,Tuple{(:a, :b, :c),(:x, :y)}}:
ERROR: ArgumentError: invalid index: :a of type Symbol
Stacktrace:
[1] to_index(::Symbol) at ./indices.jl:297
[2] to_index(::LinearIndices{2,Tuple{StaticArrays.SOneTo{3},StaticArrays.SOneTo{2}}}, ::Symbol) at ./indices.jl:274
[3] to_indices at ./indices.jl:325 [inlined]
[4] to_indices at ./indices.jl:321 [inlined]
[5] getindex at ./abstractarray.jl:980 [inlined]
[6] (::LabelledArrays.var"#53#54"{Tuple{Int64,Int64},LinearIndices{2,Tuple{StaticArrays.SOneTo{3},StaticArrays.SOneTo{2}}}})(::Tuple{Symbol,Symbol,Symbol}) at /Users/dutilleu/.julia/packages/LabelledArrays/74Tbn/src/LabelledArrays.jl:37
[7] findfirst(::LabelledArrays.var"#53#54"{Tuple{Int64,Int64},LinearIndices{2,Tuple{StaticArrays.SOneTo{3},StaticArrays.SOneTo{2}}}}, ::Tuple{Tuple{Symbol,Symbol,Symbol},Tuple{Symbol,Symbol}}) at ./array.jl:1776
[8] lazypair at /Users/dutilleu/.julia/packages/LabelledArrays/74Tbn/src/LabelledArrays.jl:35 [inlined]
[9] getindex at /Users/dutilleu/.julia/packages/LabelledArrays/74Tbn/src/LabelledArrays.jl:30 [inlined]
[10] isassigned(::LabelledArrays.PrintWrapper{Int64,2,typeof(LabelledArrays.lazypair),SLArray{Tuple{3,2},Int64,2,6,Tuple{(:a, :b, :c),(:x, :y)}}}, ::Int64, ::Int64) at ./abstractarray.jl:404
[11] alignment(::IOContext{REPL.Terminals.TTYTerminal}, ::LabelledArrays.PrintWrapper{Int64,2,typeof(LabelledArrays.lazypair),SLArray{Tuple{3,2},Int64,2,6,Tuple{(:a, :b, :c),(:x, :y)}}}, ::UnitRange{Int64}, ::UnitRange{Int64}, ::Int64, ::Int64, ::Int64) at ./arrayshow.jl:67
[12] print_matrix(::IOContext{REPL.Terminals.TTYTerminal}, ::LabelledArrays.PrintWrapper{Int64,2,typeof(LabelledArrays.lazypair),SLArray{Tuple{3,2},Int64,2,6,Tuple{(:a, :b, :c),(:x, :y)}}}, ::String, ::String, ::String, ::String, ::String, ::String, ::Int64, ::Int64) at ./arrayshow.jl:189
[13] print_matrix at ./arrayshow.jl:162 [inlined]
[14] print_array at ./arrayshow.jl:310 [inlined]
[15] show(::IOContext{REPL.Terminals.TTYTerminal}, ::SLArray{Tuple{3,2},Int64,2,6,Tuple{(:a, :b, :c),(:x, :y)}}) at /Users/dutilleu/.julia/packages/LabelledArrays/74Tbn/src/LabelledArrays.jl:51
[16] show(::IOContext{REPL.Terminals.TTYTerminal}, ::MIME{Symbol("text/plain")}, ::SLArray{Tuple{3,2},Int64,2,6,Tuple{(:a, :b, :c),(:x, :y)}}) at /Users/dutilleu/.julia/packages/LabelledArrays/74Tbn/src/LabelledArrays.jl:42
[17] display(::REPL.REPLDisplay{REPL.LineEditREPL}, ::MIME{Symbol("text/plain")}, ::SLArray{Tuple{3,2},Int64,2,6,Tuple{(:a, :b, :c),(:x, :y)}}) at /Users/dutilleu/.julia/packages/OhMyREPL/7qVFi/src/output_prompt_overwrite.jl:6
[18] display(::REPL.REPLDisplay, ::Any) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.4/REPL/src/REPL.jl:141
[19] display(::Any) at ./multimedia.jl:323
[20] #invokelatest#1 at ./essentials.jl:712 [inlined]
[21] invokelatest at ./essentials.jl:711 [inlined]
[22] print_response(::IO, ::Any, ::Bool, ::Bool, ::Any) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.4/REPL/src/REPL.jl:161
[23] print_response(::REPL.AbstractREPL, ::Any, ::Bool, ::Bool) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.4/REPL/src/REPL.jl:146
[24] (::REPL.var"#do_respond#38"{Bool,REPL.var"#48#57"{REPL.LineEditREPL,REPL.REPLHistoryProvider},REPL.LineEditREPL,REPL.LineEdit.Prompt})(::Any, ::Any, ::Any) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.4/REPL/src/REPL.jl:729
[25] #invokelatest#1 at ./essentials.jl:712 [inlined]
[26] invokelatest at ./essentials.jl:711 [inlined]
[27] run_interface(::REPL.Terminals.TextTerminal, ::REPL.LineEdit.ModalInterface, ::REPL.LineEdit.MIState) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.4/REPL/src/LineEdit.jl:2354
[28] run_frontend(::REPL.LineEditREPL, ::REPL.REPLBackendRef) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.4/REPL/src/REPL.jl:1055
[29] run_repl(::REPL.AbstractREPL, ::Any) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.4/REPL/src/REPL.jl:206
[30] (::Base.var"#764#766"{Bool,Bool,Bool,Bool})(::Module) at ./client.jl:383
[31] #invokelatest#1 at ./essentials.jl:712 [inlined]
[32] invokelatest at ./essentials.jl:711 [inlined]
[33] run_main_repl(::Bool, ::Bool, ::Bool, ::Bool, ::Bool) at ./client.jl:367
[34] exec_options(::Base.JLOptions) at ./client.jl:305
[35] _start() at ./client.jl:484

The regular array example fails also.

I am running:

Julia Version 1.4.0
Commit b8e9a9ecc6 (2020-03-21 16:36 UTC)
Platform Info:
OS: macOS (x86_64-apple-darwin18.6.0)
CPU: Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-8.0.1 (ORCJIT, haswell)

Any idea?
Kind regards,

Guillaume

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions