Anomalous "JuliaSyntax parser failed" error - julia 1.11.0-DEV

Running julia parsererr2.jl (with parsererr2.jl as shown later) produces a proper error message* about a misplaced bracket:

ERROR: LoadError: syntax: missing last argument in "w[4]:" range expression 
Stacktrace:
 [1] top-level scope
   @ ... /parsererr2.jl:10
in expression starting at ... /parsererr2.jl:10

*Message shown with file path redacted

Here is the program:

module d6
mutable struct SE
    w   ::String
    vb  ::Int
    ve  ::Int
end
vv(s) = 5
function main()
    wi=["aaaa", "bbbb",]
    wo = [SE(w, vv(w), vv(w[4]:end)) for w in sort(unique(wi))]
end
main()
end # module

Note, julia --version shows julia version 1.9.2 and julia-latest --version shows julia version 1.11.0-DEV on my ubuntu.22.04 linux system.

Running julia-latest parsererr2.jl with the wo = line split via a newline before for results in an error message with mostly the same content as julia version 1.9.2’s message (with 2 context lines and a header line added). Without that newline, julia-latest parsererr2.jl produces an anomalous error message which includes an exception report and quotes the whole program:

┌ Error: JuliaSyntax parser failed — falling back to flisp!
│   exception = (BoundsError(Any[], (1,)), Union{Ptr{Nothing}, Base.InterpreterIP}[Ptr{Nothing} @0x00007ff209c3b5ec, Ptr{Nothing} @0x00007ff1f7d21d17, Ptr{Nothing} @0x00007ff1f73ff479, Ptr{Nothing} @0x00007ff1f73fefa4, Ptr{Nothing} @0x00007ff1f73fefa4, Ptr{Nothing} @0x00007ff1f774659f, Ptr{Nothing} @0x00007ff1f83a3e50, Ptr{Nothing} @0x00007ff1f7682b5c, Ptr{Nothing} @0x00007ff209bb5ccd, Ptr{Nothing} @0x00007ff209bc6329, Ptr{Nothing} @0x00007ff209bb5ccd, Ptr{Nothing} @0x00007ff209bc83e8, Ptr{Nothing} @0x00007ff1f7439d43, Ptr{Nothing} @0x00007ff209bb5ccd, Ptr{Nothing} @0x00007ff209bc83e8, Ptr{Nothing} @0x00007ff1f763b2ca, Ptr{Nothing} @0x00007ff209bb5ccd, Ptr{Nothing} @0x00007ff209bc83e8, Ptr{Nothing} @0x00007ff1f7ab5dcd, Ptr{Nothing} @0x00007ff209bb5ccd, Ptr{Nothing} @0x00007ff209bc83e8, Ptr{Nothing} @0x00007ff1f8143201, Ptr{Nothing} @0x00007ff209bb5ccd, Ptr{Nothing} @0x00007ff1f787d243, Ptr{Nothing} @0x00007ff1f7c075d6, Ptr{Nothing} @0x00007ff209bb5ccd, Ptr{Nothing} @0x00007ff1f7ad4723, Ptr{Nothing} @0x00007ff1f789abcd, Ptr{Nothing} @0x00007ff1f7df648a, Ptr{Nothing} @0x00007ff209bb5ccd, Ptr{Nothing} @0x00007ff1f7ca64e5, Ptr{Nothing} @0x00007ff1f7c98972, Ptr{Nothing} @0x00007ff1f820ed83, Ptr{Nothing} @0x00007ff209bb5ccd, Ptr{Nothing} @0x00007ff209c24012, Ptr{Nothing} @0x00007ff209c24aee, Ptr{Nothing} @0x0000000000401088, Ptr{Nothing} @0x00007ff20a79bd8f, Ptr{Nothing} @0x00007ff20a79be3f, Ptr{Nothing} @0x00000000004010b8])
│   offset = 0
│   code = module d6
mutable struct SE
    w   ::String
    vb  ::Int
    ve  ::Int
end
vv(s) = 5
function main()
    wi=["aaaa", "bbbb",]
    wo = [SE(w, vv(w), vv(w[4]:end)) for w in sort(unique(wi))]
end
main()
end # module

└ @ Base.JuliaSyntax /cache/build/default-amdci4-1/julialang/julia-master/base/JuliaSyntax/src/hooks.jl:258
ERROR: LoadError: syntax: missing last argument in "w[4]:" range expression 
Stacktrace:
 [1] top-level scope
   @ ... /parsererr2.jl:10
in expression starting at ... /parsererr2.jl:10
1 Like

you likely meant to write w[4:end] instead of w[4]:end

Please report the bug to Issues · JuliaLang/julia · GitHub

Yes, of course. The post is about julia 1.11.0-DEV error handling vs julia 1.9.2.

1 Like

nsajko, I set up to report this there, but didn’t do so. A few minutes ago I installed Julia Version 1.12.0-DEV.800 via jill install latest, with the plan of reporting the error against a more-up-to-date version. However, unlike Julia 1.11.0-DEV.715, Julia 1.12.0-DEV.800 handles the error properly, as below.

ERROR: LoadError: ParseError:
# Error @ ... /parsererr2.jl:10:32
    wi=["aaaa", "bbbb",]
    wo = [SE(w, vv(w), vv(w[4]:end)) for w in sort(unique(wi))]
#                              └ ── missing last argument in range expression
Stacktrace:
 [1] top-level scope
   @ ... /parsererr2.jl:10
 [2] include
   @ ./Base.jl:580 [inlined]
 [3] exec_options(opts::Base.JLOptions)
   @ Base ./client.jl:324
 [4] _start()
   @ Base ./client.jl:532
in expression starting at ... /parsererr2.jl:10

versioninfo() for 1.11.0 and 1.12.0 on my system:

Julia Version 1.11.0-DEV.715
Commit abd00d09ce3 (2023-10-24 02:31 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 4 × Intel(R) Core(TM) i5-7500 CPU @ 3.40GHz
  WORD_SIZE: 64
  LLVM: libLLVM-15.0.7 (ORCJIT, skylake)
  Threads: 1 on 4 virtual cores

Julia Version 1.12.0-DEV.800
Commit 334e4d9f5d5 (2024-06-28 15:46 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 4 × Intel(R) Core(TM) i5-7500 CPU @ 3.40GHz
  WORD_SIZE: 64
  LLVM: libLLVM-17.0.6 (ORCJIT, skylake)
Threads: 1 default, 0 interactive, 1 GC (on 4 virtual cores)
1 Like

It should probably still be reported, while noting the status on v1.10 vs v1.11-dev vs nightly.

nsajko, I reported the problem via Anomalous “JuliaSyntax parser failed” error - julia 1.11.0-DEV.715 · Issue #54989 · JuliaLang/julia · GitHub

1 Like