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

Can not step into body of @error because "UndefVarError: REPL[1] not defined" #535

Closed
melonedo opened this issue Apr 24, 2022 · 2 comments · Fixed by #540
Closed

Can not step into body of @error because "UndefVarError: REPL[1] not defined" #535

melonedo opened this issue Apr 24, 2022 · 2 comments · Fixed by #540
Labels
bug Something isn't working

Comments

@melonedo
Copy link

melonedo commented Apr 24, 2022

MWE:

using JuliaInterpreter
f() = @error "ex"
frame = JuliaInterpreter.enter_call(f)
debug_command(frame, :c)
#=
ERROR: UndefVarError: REPL[17] not defined
Stacktrace:
 [1] collect_args(recurse::Any, frame::Frame, call_expr::Expr; isfc::Bool)
   @ JuliaInterpreter C:\Users\melonedo\.julia\packages\JuliaInterpreter\Q7nmG\src\interpret.jl:60
=#

I expect it to log some message instead of crashing.

The issue is identical to #441, but since I am using 0.9.13, it should have already been fixed.

@KristofferC
Copy link
Member

The following diff seems to fix it:

julia> f() = @error "ex"
f (generic function with 1 method)

julia> frame = JuliaInterpreter.enter_call(f);

julia> debug_command(frame, :c)
┌ Error: ex
└ @ Main REPL[4]:1
@@ -132,6 +132,7 @@ function resolvefc(frame, @nospecialize(expr))
     error("unexpected ccall to ", expr)
 end
 
+maybe_quote(x) = isa(x, Symbol) ? QuoteNode(x) : x
 function collect_args(@nospecialize(recurse), frame::Frame, call_expr::Expr; isfc::Bool=false)
     args = frame.framedata.callargs
     resize!(args, length(call_expr.args))
@@ -141,7 +142,7 @@ function collect_args(@nospecialize(recurse), frame::Frame, call_expr::Expr; isf
         if isexpr(call_expr.args[i], :call)
             args[i] = lookup_or_eval(recurse, frame, call_expr.args[i])
         else
-            args[i] = @lookup(mod, frame, call_expr.args[i])
+            args[i] = @lookup(mod, frame, maybe_quote(call_expr.args[i]))
         end
     end
     return args

timholy added a commit that referenced this issue Jul 24, 2022
This was added in #442 and inadvertently removed in #532.
However, the test in #442 was not stringent enough; the test added here
comes from #535.

Fixes #535
Fixes timholy/Revise.jl#695
@timholy
Copy link
Member

timholy commented Jul 24, 2022

git bisects to #532. AFAICT this is because it seems to largely revert #442. The test is still there and passes, so the test wasn't strenuous enough. The test here catches it, and has been added in #540. Thanks, @melonedo!

timholy added a commit that referenced this issue Jul 25, 2022
* Re-impose "no double lookup" for invoke

This was added in #442 and inadvertently removed in #532.
However, the test in #442 was not stringent enough; the test added here
comes from #535.

Fixes #535
Fixes timholy/Revise.jl#695
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants