JuliaLang / JuliaSyntax.jl

The Julia compiler frontend
Other
270 stars 33 forks source link

Bad error message for missing end #476

Open oscardssmith opened 1 month ago

oscardssmith commented 1 month ago

Right now the error for missing an end in otherwise good code is

ERROR: LoadError: ParseError:
# Error @ /home/oscardssmith/.julia/dev/OrdinaryDiffEq/src/derivative_utils.jl:766:5
    end
end
#  
└ ── Expected `end`

The problem here is that the error location reported is just the end of the file (since everything else could be correct up to that point). It would be much better if the error instead (or in addition) pointed to the line requiring an end from which an end was missing since this line will generally be much more useful for figuring out where the missing end is supposed to go.

pfitzseb commented 1 month ago

Would also be useful to print the block opener, maybe?