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

Fix bug in Salsa stack trace printing: off-by-one #26

Merged
merged 1 commit into from
Jul 5, 2020

Conversation

NHDaly
Copy link
Collaborator

@NHDaly NHDaly commented Jul 4, 2020

Fixes #25

Now this prints correctly:

julia> using Salsa

julia> @derived f(rt, x) = g(rt, x)
f (generic function with 1 method)

julia> @derived g(rt, x) = h(rt, x)
g (generic function with 1 method)

julia> @derived h(rt, _) = error("OH NO")
h (generic function with 1 method)

julia> f(Runtime(), 1)
ERROR: SalsaWrappedException: Error encountered while executing Salsa derived function:
OH NO

------ Salsa Trace -----------------
[1] @derived f(::Runtime, 1::Any)
[2] @derived g(::Runtime, 1::Any)
[3] @derived h(::Runtime, 1::Any)
------------------------------------

Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] %%__user_h(::Salsa._TracingRuntime{Salsa.EmptyContext,Salsa._DefaultSalsaStorage.DefaultStorage}, ::Int64) at ./REPL[16]:1
 [3] invoke_user_function(::Salsa._TracingRuntime{Salsa.EmptyContext,Salsa._DefaultSalsaStorage.DefaultStorage}, ::Salsa.DerivedKey{typeof(h),Tuple{Any}}, ::Int64) at /Users/daly/julia-dev/Salsa/src/Salsa.jl:612
...

@NHDaly NHDaly added bug Something isn't working error handling labels Jul 4, 2020
@NHDaly NHDaly requested a review from comnik July 4, 2020 02:34
Now this prints correctly:
```julia
julia> using Salsa

julia> @derived f(rt, x) = g(rt, x)
f (generic function with 1 method)

julia> @derived g(rt, x) = h(rt, x)
g (generic function with 1 method)

julia> @derived h(rt, _) = error("OH NO")
h (generic function with 1 method)

julia> f(Runtime(), 1)
ERROR: SalsaWrappedException: Error encountered while executing Salsa derived function:
OH NO

------ Salsa Trace -----------------
[1] @derived f(::Runtime, 1::Any)
[2] @derived g(::Runtime, 1::Any)
[3] @derived h(::Runtime, 1::Any)
------------------------------------

Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] %%__user_h(::Salsa._TracingRuntime{Salsa.EmptyContext,Salsa._DefaultSalsaStorage.DefaultStorage}, ::Int64) at ./REPL[16]:1
 [3] invoke_user_function(::Salsa._TracingRuntime{Salsa.EmptyContext,Salsa._DefaultSalsaStorage.DefaultStorage}, ::Salsa.DerivedKey{typeof(h),Tuple{Any}}, ::Int64) at /Users/daly/julia-dev/Salsa/src/Salsa.jl:612
...
```
@NHDaly NHDaly force-pushed the nhd-salsa-stack-fix-printing branch from 0222ff8 to 1f76ead Compare July 4, 2020 02:36
Copy link
Contributor

@comnik comnik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch :)

@NHDaly
Copy link
Collaborator Author

NHDaly commented Jul 5, 2020

Thanks. Merging now. Let me know if you have any preference on reversing the print order, or changing the numbering; it's easy to do.

I think my preference might be for keeping the same order but reversing the numbering?

@NHDaly NHDaly merged commit 251be45 into master Jul 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working error handling
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug in new Salsa pretty-printed stack traces: wrong stack traces
2 participants