JuliaSyntax.jl
JuliaSyntax.jl copied to clipboard
Error in functor definition with where clause and newlines
When defining a functor in julia version 1.12, I get an error (depending on the formatting), while 1.11 and 1.10 work fine. MWE:
julia> function (
a::Tuple{A}
)() where {A<:Int64} end
ERROR: UndefVarError: `A` not defined in `Main`
Suggestion: check for spelling errors or missing imports.
Stacktrace:
[1] top-level scope
@ REPL[1]:1
Putting it in one line works like normal, even with spaces. Just the newlines seem to break it.
julia> function (a::Tuple{A})() where {A<:Int64} end
julia> function ( a::Tuple{A} )() where {A<:Int64} end
1.12 versioninfo():
julia> versioninfo()
Julia Version 1.12.0-beta1
Commit c175ace780d (2025-04-02 11:19 UTC)
Build Info:
Official https://julialang.org release
Platform Info:
OS: Linux (x86_64-linux-gnu)
CPU: 24 × AMD Ryzen 9 7900X3D 12-Core Processor
WORD_SIZE: 64
LLVM: libLLVM-18.1.7 (ORCJIT, znver4)
GC: Built with stock GC
Threads: 1 default, 1 interactive, 1 GC (on 24 virtual cores)
parse is deciding too quickly that ( is going to be a tuple here, while flisp previously saw that it was not
julia> Meta.parse("function (
a::Tuple{A}
)() where {A<:Int64} end")
:(function (a::Tuple{A},)
#= none:1 =#
#= none:3 =#
() where A <: Int64
end)
julia> Base.fl_parse("function (
a::Tuple{A}
)() where {A<:Int64} end", "filename", 1, 0, :all)[1]
:($(Expr(:toplevel, :(#= filename:1 =#), :(function (a::Tuple{A})() where A <: Int64
#= filename:1 =#
#= filename:3 =#
end))))