Skip to content

finer-grained location info for error messages, strack traces: line number, column number range #53090

Open
@nsajko

Description

a.jl:

1 +
2 +
3 +
error() +
5

b.jl:

1 + 2 + 3 + 4 + error() + 5

REPL session:

julia> include("a.jl")  # It'd be nice to get a more accurate line number here, i.e., "4" instead of "1"
ERROR: LoadError: 
Stacktrace:
 [1] error()
   @ Base ./error.jl:44
 [2] top-level scope
   @ /tmp/asdoi98uz/a.jl:1
 [3] include(fname::String)
   @ Main ./sysimg.jl:38
 [4] top-level scope
   @ REPL[1]:1
in expression starting at /tmp/asdoi98uz/a.jl:1

julia> include("b.jl")  # It'd be nice to get a column number range here for the offending call, `error()`
ERROR: LoadError: 
Stacktrace:
 [1] error()
   @ Base ./error.jl:44
 [2] top-level scope
   @ /tmp/asdoi98uz/b.jl:1
 [3] include(fname::String)
   @ Main ./sysimg.jl:38
 [4] top-level scope
   @ REPL[2]:1
in expression starting at /tmp/asdoi98uz/b.jl:1

julia> versioninfo()
Julia Version 1.11.0-DEV.1389
Commit ecc14ca3888 (2024-01-27 15:45 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 8 × AMD Ryzen 3 5300U with Radeon Graphics
  WORD_SIZE: 64
  LLVM: libLLVM-16.0.6 (ORCJIT, znver2)
Threads: 1 default, 0 interactive, 1 GC (on 8 virtual cores)

Related issues: #33735, #38531, #50834

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    compiler:loweringSyntax lowering (compiler front end, 2nd stage)error handlingHandling of exceptions by Julia or the usererror messagesBetter, more actionable error messagesparserLanguage parsing and surface syntax

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions