Skip to content

Meta.parse on invalid syntax with enable_in_core! #8

@fonsp

Description

@fonsp

I noticed that the errors are different:

julia> Meta.parse("[(1,2]")
ERROR: Base.Meta.ParseError("unexpected \"]\" in argument list")
Stacktrace:
 [1] #parse#3
   @ ./meta.jl:237 [inlined]
 [2] parse(str::String; raise::Bool, depwarn::Bool)
   @ Base.Meta ./meta.jl:268
 [3] parse(str::String)
   @ Base.Meta ./meta.jl:268
 [4] top-level scope
   @ REPL[1]:1

julia> using JuliaSyntax

julia> JuliaSyntax.enable_in_core!()

julia> Meta.parse("[(1,2]")
ERROR: MethodError: Cannot `convert` an object of type JuliaSyntax.ParseError to an object of type String
Closest candidates are:
  convert(::Type{String}, ::String) at /Applications/Julia-1.7 x86.app/Contents/Resources/julia/share/julia/base/essentials.jl:223
  convert(::Type{T}, ::T) where T<:AbstractString at /Applications/Julia-1.7 x86.app/Contents/Resources/julia/share/julia/base/strings/basic.jl:231
  convert(::Type{T}, ::AbstractString) where T<:AbstractString at /Applications/Julia-1.7 x86.app/Contents/Resources/julia/share/julia/base/strings/basic.jl:232
  ...
Stacktrace:
 [1] Base.Meta.ParseError(msg::JuliaSyntax.ParseError)
   @ Base.Meta ./meta.jl:190
 [2] #parse#3
   @ ./meta.jl:237 [inlined]
 [3] parse(str::String; raise::Bool, depwarn::Bool)
   @ Base.Meta ./meta.jl:268
 [4] parse(str::String)
   @ Base.Meta ./meta.jl:268
 [5] top-level scope
   @ none:1

Not sure if this matters or not, just thought i would report it

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