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

REPL completion error: UndefVarError #27184

Closed
luchr opened this issue May 20, 2018 · 5 comments
Closed

REPL completion error: UndefVarError #27184

luchr opened this issue May 20, 2018 · 5 comments
Labels
kind:bug Indicates an unexpected problem or unintended behavior stdlib:REPL Julia's REPL (Read Eval Print Loop)

Comments

@luchr
Copy link

luchr commented May 20, 2018

Open julia with REPL, type @nonexist. and hit Tab:

   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: https://docs.julialang.org
   _ _   _| |_  __ _   |  Type "?help" for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.7.0-DEV.5138 (2018-05-19 22:52 UTC)
 _/ |\__'_|_|_|\__'_|  |  Commit a465d33f6 (1 day old master)
|__/                   |  x86_64-redhat-linux

julia> @nonexist.┌ Error: Error in the keymap
│   exception =
│    LoadError: UndefVarError: @nonexist not defined
│    Stacktrace:
│     [1] top-level scope
│     [2] lower at ./meta.jl:68 [inlined]
│     [3] get_type(::Expr, ::Module) at /TEST/usr/share/julia/stdlib/v0.7/REPL/src/REPLCompletions.jl:362
│     [4] complete_symbol(::String, ::getfield(REPL.REPLCompletions, Symbol("##15#17"))) at /TEST/usr/share/julia/stdlib/v0.7/REPL/src/REPLCompletions.jl:63
│     [5] completions(::String, ::Int64) at /TEST/usr/share/julia/stdlib/v0.7/REPL/src/REPLCompletions.jl:648
...

@Keno Keno added kind:bug Indicates an unexpected problem or unintended behavior stdlib:REPL Julia's REPL (Read Eval Print Loop) labels May 21, 2018
@JeffBezanson
Copy link
Sponsor Member

This seems to be fixed. Maybe by #26930 ?

@luchr
Copy link
Author

luchr commented Jul 24, 2018

Yes. It has been fixed. [I don't know when].

@luchr luchr closed this as completed Jul 24, 2018
@cafaxo
Copy link
Contributor

cafaxo commented Jul 24, 2018

This does not seem to be fixed yet:

               _
   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: https://docs.julialang.org
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.7.0-beta2.91 (2018-07-24 04:22 UTC)
 _/ |\__'_|_|_|\__'_|  |  Commit cbb6433669 (0 days old master)
|__/                   |  x86_64-pc-linux-gnu

julia> @nonexist.┌ Error: Error in the keymap
│   exception =
│    LoadError: UndefVarError: @nonexist not defined
│    Stacktrace:
│     [1] top-level scope
│     [2] lower at ./meta.jl:68 [inlined]
│     [3] get_type(::Expr, ::Module) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v0.7/REPL/src/REPLCompletions.jl:422
│     [4] complete_symbol(::String, ::getfield(REPL.REPLCompletions, Symbol("##21#25")), ::Module) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v0.7/REPL/src/REPLCompletions.jl:123

@KristofferC KristofferC reopened this Jul 24, 2018
@KristofferC
Copy link
Sponsor Member

KristofferC commented Jul 24, 2018

Error is thrown from

julia> Meta.lower(Main, :(@noexist))
ERROR: LoadError: UndefVarError: @noexist not defined
Stacktrace:
 [1] top-level scope
 [2] lower(::Module, ::Any) at ./meta.jl:68
 [3] top-level scope at none:0
in expression starting at REPL[9]:1

Should we bail on macros?

diff --git a/stdlib/REPL/src/REPLCompletions.jl b/stdlib/REPL/src/REPLCompletions.jl
index fc84bd2b8d..f9dc16805e 100644
--- a/stdlib/REPL/src/REPLCompletions.jl
+++ b/stdlib/REPL/src/REPLCompletions.jl
@@ -419,6 +419,7 @@ function get_type(sym::Expr, fn::Module)
     # try to analyze nests of calls. if this fails, try using the expanded form.
     val, found = try_get_type(sym, fn)
     found && return val, found
+    sym.head == :macrocall && return (Any, false)
     return try_get_type(Meta.lower(fn, sym), fn)
 end

@jaakkor2
Copy link
Contributor

@nonexist. + TAB-key still errors on v"1.6.0-rc1".

aviatesk added a commit to aviatesk/julia that referenced this issue Apr 27, 2021
aviatesk added a commit to aviatesk/julia that referenced this issue Apr 27, 2021
aviatesk added a commit to aviatesk/julia that referenced this issue Apr 27, 2021
KristofferC pushed a commit that referenced this issue Nov 8, 2021
KristofferC pushed a commit that referenced this issue Nov 11, 2021
KristofferC pushed a commit that referenced this issue Nov 12, 2021
staticfloat pushed a commit that referenced this issue Dec 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bug Indicates an unexpected problem or unintended behavior stdlib:REPL Julia's REPL (Read Eval Print Loop)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants