Julia reports an error in line 1. More precisely, in the previously executed line. Without the semicolon after Dict(), the error is correctly reported in line 2.
More details
➜ echo -e "a = 1\n b ::Dict{String => String} = Dict();\n" > a.jl && julia a.jl
ERROR: LoadError: TypeError: in Type, in parameter, expected Type, got a value of type Pair{DataType, DataType}
Stacktrace:
[1] top-level scope
@ ~/..../a.jl:1
in expression starting at /home/..../a.jl:1
➜ echo -e "a = 1\n b ::Dict{String => String} = Dict()\n" > a.jl && julia a.jl
ERROR: LoadError: TypeError: in Type, in parameter, expected Type, got a value of type Pair{DataType, DataType}
Stacktrace:
[1] top-level scope
@ ~/..../a.jl:2
in expression starting at /home/..../a.jl:2
With syntax errors, the error is pinpointed correctly regardless of whether the semicolon is present or not.
Note the duplicated internal line number :(#= none:1 =#) preceding the ; chain; that is showing up in the stacktrace. Good news is the expected behavior can happen a couple versions later; bad news it seems there’s some hurdles in the way of backports to released versions: parser gives wrong line number of codes with semi-colon · Issue #57645 · JuliaLang/julia. At least semicolons aren’t necessary for delimiting lines in a multiline string and don’t suppress output in this context, so you could do without them for now.