diff --git a/src/julia-syntax.scm b/src/julia-syntax.scm index 9e846bb181f3d..7ea0e79e59085 100644 --- a/src/julia-syntax.scm +++ b/src/julia-syntax.scm @@ -4020,13 +4020,13 @@ f(x) = yt(x) `(line ,current-line ,current-file) `(line ,current-line ,current-file ,(caar locstack))) linetable)) - (set! current-loc (+ 1 current-loc))))) + (set! current-loc (- (length linetable) 1))))) ((and (length> e 2) (eq? (car e) 'meta) (eq? (cadr e) 'push_loc)) (set! locstack (cons (list current-loc current-line current-file) locstack)) (set! current-file (caddr e)) (set! current-line 0) (set! linetable (cons `(line ,current-line ,current-file ,current-loc) linetable)) - (set! current-loc (+ 1 current-loc))) + (set! current-loc (- (length linetable) 1))) ((and (length= e 2) (eq? (car e) 'meta) (eq? (cadr e) 'pop_loc)) (let ((l (car locstack))) (set! locstack (cdr locstack)) diff --git a/test/backtrace.jl b/test/backtrace.jl index 0da3779c88eda..9c7847ac34741 100644 --- a/test/backtrace.jl +++ b/test/backtrace.jl @@ -177,3 +177,15 @@ let bt, found = false end @test found end + +# issue 28618 +let bt, found = false + @info "" + bt = backtrace() + for frame in map(StackTraces.lookup, bt) + if frame[1].line == @__LINE__() - 2 && frame[1].file == Symbol(@__FILE__) + found = true; break + end + end + @test found +end