JuliaLang / JuliaSyntax.jl

The Julia compiler frontend
Other
267 stars 32 forks source link

Unexpected `ParseError` with `import Makie: (..)` #370

Closed ericphanson closed 8 months ago

ericphanson commented 8 months ago
julia> JuliaSyntax.parseall(JuliaSyntax.GreenNode, "import Makie: (..)")
ERROR: ParseError:
# Warning @ line 1:15
import Makie: (..)
#             └──┘ ── parentheses are not required here
Stacktrace:
 [1] _parse(rule::Symbol, need_eof::Bool, ::Type{JuliaSyntax.GreenNode}, text::String, index::Int64; version::VersionNumber, ignore_trivia::Bool, filename::Nothing, first_line::Int64, ignore_errors::Bool, ignore_warnings::Bool, kws::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
   @ JuliaSyntax ~/.julia/packages/JuliaSyntax/z5WbP/src/parser_api.jl:93
 [2] _parse (repeats 2 times)
   @ ~/.julia/packages/JuliaSyntax/z5WbP/src/parser_api.jl:77 [inlined]
 [3] #parseall#98
   @ ~/.julia/packages/JuliaSyntax/z5WbP/src/parser_api.jl:143 [inlined]
 [4] parseall(::Type{JuliaSyntax.GreenNode}, text::String)
   @ JuliaSyntax ~/.julia/packages/JuliaSyntax/z5WbP/src/parser_api.jl:143
 [5] top-level scope
   @ REPL[11]:1

using JuliaSyntax v0.4.6. This seems unexpected because (1) they are required, and (2) even if they weren't, that doesn't seem like it should be an error.

on a few days old master build of julia:

julia> import Makie: (..)

julia> import Makie: ..

ERROR: ParseError:
# Warning @ REPL[4]:1:17
#               ┌
import Makie: ..

┘ ── space between dots in import path
# Error @ REPL[4]:2:2
import Makie: ..

#└ ── premature end of input
Stacktrace:
 [1] top-level scope
   @ none:1

so we can see that the syntax is OK and the parens are required.

Found via:

using PackageAnalyzer
ENV["JULIA_DEBUG"] = "PackageAnalyzer"
analyze("Makie")
c42f commented 8 months ago

Duplicate of #350

Thanks for the report!