-
-
Notifications
You must be signed in to change notification settings - Fork 38
Closed
Description
Printing errors arising from parseatom
sometimes fails, but not parsestmt
or parseall
.
MWE:
julia> exc = try JuliaSyntax.parseatom(Expr, ")") ; catch e ; e end
JuliaSyntax.ParseError(SourceFile("", 0, nothing, 1, [1, 1]), JuliaSyntax.Diagnostic[JuliaSyntax.Diagnostic(1, 0, :error, "unexpected `)`"), JuliaSyntax.Diagnostic(1, 1, :error, "unexpected text after parsing atom")], :none)
julia> showerror(stdout, exc)
ParseError:
# Error @ line 1:1
ERROR: BoundsError: attempt to access empty SubString{String} at index [0]
Stacktrace:
[1] checkbounds(s::SubString{String}, I::Int64)
@ Base ./strings/basic.jl:216 [inlined]
[2] getindex(s::SubString{String}, i::Int64)
@ Base ./strings/substring.jl:91
[3] getindex(source::SourceFile, i::Int64)
@ JuliaSyntax ~/.julia/dev/JuliaSyntax/src/source_files.jl:120
[4] highlight(io::Base.TTY, source::SourceFile, range::UnitRange{…}; color::Tuple{…}, context_lines_before::Int64, context_lines_inner::Int64, context_lines_after::Int64, note::String, notecolor::Symbol)
@ JuliaSyntax ~/.julia/dev/JuliaSyntax/src/source_files.jl:222
[5] kwcall(::NamedTuple, ::typeof(JuliaSyntax.highlight), io::IO, source::SourceFile, range::UnitRange)
@ JuliaSyntax ~/.julia/dev/JuliaSyntax/src/source_files.jl:190 [inlined]
[6] show_diagnostic(io::Base.TTY, diagnostic::JuliaSyntax.Diagnostic, source::SourceFile)
@ JuliaSyntax ~/.julia/dev/JuliaSyntax/src/diagnostics.jl:76
[7] showerror(io::Base.TTY, err::JuliaSyntax.ParseError; limit::Bool)
@ JuliaSyntax ~/.julia/dev/JuliaSyntax/src/parser_api.jl:21 [inlined]
[8] showerror(io::Base.TTY, err::JuliaSyntax.ParseError)
@ JuliaSyntax ~/.julia/dev/JuliaSyntax/src/parser_api.jl:18
[9] top-level scope
@ REPL[108]:1
Some type information was truncated. Use `show(err)` to see complete types.
Found in JuliaLang/julia#50245
Metadata
Metadata
Assignees
Labels
No labels