SciML / SciML/LabelledArrays.jl

Labelled slice fails in Julia 1.4.0

Open
#83 14 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
125
Forks
20
Avg merge
6h 3m
Merged PRs (30d)
10

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the labelled-slice and regular-array examples from the issue on Julia 1.4.0, then inspect src/LabelledArrays.jl around lines 30, 35, 37, 42, and 51, where the stack trace points. Done means the examples display successfully without the invalid Symbol index error.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
data
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.