Skip to content

inaccurate line numbers in syntax errors #14

@stevengj

Description

@stevengj
julia> softscope_include_string(Main, "begin\n3\nx ++++ y\nend")
ERROR: LoadError: syntax: "++" is not a unary operator
Stacktrace:
 [1] softscope_include_string(::Module, ::String, ::String) at /Users/stevenj/.julia/dev/SoftGlobalScope/src/SoftGlobalScope.jl:201
 [2] softscope_include_string(::Module, ::String) at /Users/stevenj/.julia/dev/SoftGlobalScope/src/SoftGlobalScope.jl:192
 [3] top-level scope at none:0
in expression starting at string:1

julia> include_string(Main, "begin\n3\nx ++++ y\nend")
ERROR: LoadError: syntax: "++" is not a unary operator
Stacktrace:
 [1] include_string(::Module, ::String, ::String) at ./loading.jl:1002
 [2] include_string(::Module, ::String) at ./loading.jl:1006
 [3] top-level scope at none:0
in expression starting at string:3

Notice that we are giving the syntax error at string:1 rather than at string:3.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions