Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parse! with an IOBuffer errors on Julia 1.11-rc1 #443

Open
davidanthoff opened this issue Jun 30, 2024 · 2 comments
Open

parse! with an IOBuffer errors on Julia 1.11-rc1 #443

davidanthoff opened this issue Jun 30, 2024 · 2 comments

Comments

@davidanthoff
Copy link
Contributor

Here is the repo:

using JuliaSyntax

source = "println()"

JuliaSyntax.parse!(SyntaxNode, IOBuffer(source))

generates an error

ERROR: MethodError: no method matching JuliaSyntax.ParseStream(::Memory{UInt8}, ::IOBuffer, ::Int64, ::VersionNumber)
The type `JuliaSyntax.ParseStream` exists, but no method is defined for this combination of argument types when trying to construct it.

Closest candidates are:
  JuliaSyntax.ParseStream(::Vector{UInt8}, ::Any, ::Integer, ::VersionNumber)
   @ JuliaSyntax C:\Users\david\.julia\packages\JuliaSyntax\eqCSU\src\parse_stream.jl:265
  JuliaSyntax.ParseStream(::Ptr{UInt8}, ::Integer, ::Integer; version)
   @ JuliaSyntax C:\Users\david\.julia\packages\JuliaSyntax\eqCSU\src\parse_stream.jl:298
  JuliaSyntax.ParseStream(::Vector{UInt8}; ...)
   @ JuliaSyntax C:\Users\david\.julia\packages\JuliaSyntax\eqCSU\src\parse_stream.jl:293
  ...

Stacktrace:
 [1] JuliaSyntax.ParseStream(io::IOBuffer; version::VersionNumber)
   @ JuliaSyntax C:\Users\david\.julia\packages\JuliaSyntax\eqCSU\src\parse_stream.jl:318
 [2] parse!(::Type{SyntaxNode}, io::IOBuffer; rule::Symbol, version::VersionNumber, kws::@Kwargs{})
   @ JuliaSyntax C:\Users\david\.julia\packages\JuliaSyntax\eqCSU\src\parser_api.jl:70
 [3] parse!(::Type{SyntaxNode}, io::IOBuffer)
   @ JuliaSyntax C:\Users\david\.julia\packages\JuliaSyntax\eqCSU\src\parser_api.jl:68
 [4] top-level scope
   @ REPL[6]:1

I'm wondering, though, whether the root cause here is some breaking change in Julia itself?

@KristofferC
Copy link
Member

I'm wondering, though, whether the root cause here is some breaking change in Julia itself?

Nah, it grabs the internal .data field and assumes it is a Vector{UInt8}:

ParseStream(io.data, io, position(io)+1, version)

@davidanthoff
Copy link
Contributor Author

@c42f could we add a parse! version that accepts a String? It seems that ParseStream already supports constructors that accept that, so that seems a very simple solution here, as I'm starting with a String in any case?

@c42f c42f mentioned this issue Aug 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants