Is there a way to get syntax messages like this to show a line number?
syntax: unexpected “)”
Is there a way to get syntax messages like this to show a line number?
syntax: unexpected “)”
from a technical point of view, no, because you can’t be sure which line is actually “missing” a )
, but I agree this is very annoying
Presumably it could at least show the line number for the unmatched (
?
Actually if it’s an unexpected )
then it is known on which line that occurs.
It is shown for me in the stacktrace in Julia 1.5:
shell> cat /tmp/tmp.jl
(1+2))
julia> include("/tmp/tmp.jl");
ERROR: LoadError: syntax: extra token ")" after end of expression
Stacktrace:
[1] top-level scope at /tmp/tmp.jl:1
[2] include(::String) at ./client.jl:457
[3] top-level scope at REPL[72]:1
in expression starting at /tmp/tmp.jl:1
I’m using 1.4.2. Maybe its a Jupyter thing? Below is my output. Other errors are flagged with a line number in the stacktrace, but extra ( or [ are not.
I have also perceived this behavior, and it is very annoying.
Yes, perhaps open an issue for Jupyter.
It’s already fixed if you use IJulia with Julia 1.5:
include_string
in order to do the soft-scoping transformation, and lost some line-number information in the process.
Thanks. I’ll be upgrading today.