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

Error: Error in the keymap in autocompleting properties involving copy of adjoint matrices #55856

Closed
jishnub opened this issue Sep 24, 2024 · 1 comment · Fixed by #56252
Closed
Labels
bug Indicates an unexpected problem or unintended behavior completions Tab and autocompletion in the repl

Comments

@jishnub
Copy link
Contributor

jishnub commented Sep 24, 2024

This is triggered by the copy(A'). line in the following (might need to wait for a few seconds after the dot):

julia> A = zeros(2,2)
2×2 Matrix{Float64}:
 0.0  0.0
 0.0  0.0

julia> copy(A').┌ Error: Error in the keymap
│   exception =
│    BoundsError: attempt to access 0-element UnitRange{Int64} at index [1]
│    Stacktrace:
│      [1] throw_boundserror(A::UnitRange{Int64}, I::Int64)
│        @ Base ./essentials.jl:14
│      [2] _getindex
│        @ ./range.jl:946 [inlined]
│      [3] getindex
│        @ ./array.jl:3082 [inlined]
│      [4] complete_identifiers!(suggestions::Vector{REPL.REPLCompletions.Completion}, context_module::Module, string::String, name::String, pos::Int64, separatorpos::Int64, startpos::Int64; comp_keywords::Bool, complete_modules_only::Bool, shift::Bool)
│        @ REPL.REPLCompletions ~/.julia/juliaup/julia-nightly/share/julia/stdlib/v1.12/REPL/src/REPLCompletions.jl:1200
│      [5] complete_identifiers!
│        @ ~/.julia/juliaup/julia-nightly/share/julia/stdlib/v1.12/REPL/src/REPLCompletions.jl:1113 [inlined]
│      [6] completions(string::String, pos::Int64, context_module::Module, shift::Bool, hint::Bool)
│        @ REPL.REPLCompletions ~/.julia/juliaup/julia-nightly/share/julia/stdlib/v1.12/REPL/src/REPLCompletions.jl:1475
│      [7] complete_line(c::REPL.REPLCompletionProvider, s::REPL.LineEdit.PromptState, mod::Module; hint::Bool)
│        @ REPL ~/.julia/juliaup/julia-nightly/share/julia/stdlib/v1.12/REPL/src/REPL.jl:774
│      [8] check_for_hint(s::REPL.LineEdit.MIState)
│        @ REPL.LineEdit ~/.julia/juliaup/julia-nightly/share/julia/stdlib/v1.12/REPL/src/LineEdit.jl:385
│      [9] (::REPL.LineEdit.var"#186#187")(s::REPL.LineEdit.MIState, data::Any, c::Union{Char, SubString{String}, String})
│        @ REPL.LineEdit ~/.julia/juliaup/julia-nightly/share/julia/stdlib/v1.12/REPL/src/LineEdit.jl:2538
│     [10] #invokelatest#1
│        @ ./essentials.jl:1048 [inlined]
│     [11] invokelatest
│        @ ./essentials.jl:1045 [inlined]
│     [12] (::REPL.LineEdit.var"#match_input##0#match_input##1"{REPL.LineEdit.var"#186#187", String})(s::Any, p::Any)
│        @ REPL.LineEdit ~/.julia/juliaup/julia-nightly/share/julia/stdlib/v1.12/REPL/src/LineEdit.jl:1722
│     [13] macro expansion
│        @ ~/.julia/juliaup/julia-nightly/share/julia/stdlib/v1.12/REPL/src/LineEdit.jl:2872 [inlined]
│     [14] macro expansion
│        @ ./lock.jl:287 [inlined]
│     [15] (::REPL.LineEdit.var"#prompt!##2#prompt!##3"{REPL.Terminals.TTYTerminal, REPL.LineEdit.ModalInterface, REPL.LineEdit.MIState, ReentrantLock, REPL.LineEdit.Prompt})()
│        @ REPL.LineEdit ~/.julia/juliaup/julia-nightly/share/julia/stdlib/v1.12/REPL/src/LineEdit.jl:2862
└ @ REPL.LineEdit ~/.julia/juliaup/julia-nightly/share/julia/stdlib/v1.12/REPL/src/LineEdit.jl:2874

julia> versioninfo()
Julia Version 1.12.0-DEV.1242
Commit c3af4fc2456 (2024-09-24 09:48 UTC)
Build Info:
  Official https://julialang.org release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 8 × Intel(R) Core(TM) i5-10310U CPU @ 1.70GHz
  WORD_SIZE: 64
  LLVM: libLLVM-18.1.7 (ORCJIT, skylake)
Threads: 1 default, 0 interactive, 1 GC (on 8 virtual cores)
Environment:
  JULIA_EDITOR = subl

Julia nightly installed using juliaup. I can replicate this on v"1.10.5" and v"1.11.0-rc3" as well. On v1.10, I needed to press TAB after the dot to trigger the error, whereas on v1.11 and nightly, this happens right after the dot if I wait for a few seconds.

@jishnub jishnub changed the title Error: Error in the keymap in autocompleting properties involving structured matrices Error: Error in the keymap in autocompleting properties involving copy of adjoint matrices Sep 24, 2024
@IanButterworth IanButterworth added the completions Tab and autocompletion in the repl label Sep 24, 2024
@IanButterworth IanButterworth added the bug Indicates an unexpected problem or unintended behavior label Oct 20, 2024
@IanButterworth
Copy link
Member

Just noting that to reproduce this you just need to type copy(A')., A doesn't need to exist.

The issue I believe is that when searching for braces we're assuming ' is only used to quote, not accounting for uses to transpose.
It's also tricky because multiple can be used to transpose repeatedly like A''''.

elseif c == '\''
in_single_quotes = true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior completions Tab and autocompletion in the repl
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants