Skip to content

Missing stack traces for errors during macro expansion #18836

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

Closed
Keno opened this issue Oct 7, 2016 · 1 comment
Closed

Missing stack traces for errors during macro expansion #18836

Keno opened this issue Oct 7, 2016 · 1 comment

Comments

@Keno
Copy link
Member

Keno commented Oct 7, 2016

julia> @noinline foo(ex) = error()
foo (generic function with 1 method)

julia> @noinline bar(ex) = foo(ex)
bar (generic function with 1 method)

julia> macro baz(ex)
           bar(ex)
       end
@baz (macro with 1 method)

julia> @baz 1+1
ERROR:
 in eval(::Module, ::Any) at ./boot.jl:234

julia> bar(:(1+1))
ERROR:
 in error() at ./error.jl:22
 in foo(::Expr) at ./REPL[2]:1
 in bar(::Expr) at ./REPL[3]:1
 in eval(::Module, ::Any) at ./boot.jl:234

Why does this happen?, well

julia> macroexpand(:(@baz 1+1))
:($(Expr(:error, ErrorException(""))))

so that's the code that actually gets interpolated. I would suggest simply putting the
backtrace from macro expansion in there as well.

@yuyichao
Copy link
Contributor

yuyichao commented Oct 7, 2016

Dup of #15643 ?

@vtjnash vtjnash closed this as completed Aug 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants