fredrikekre / Runic.jl

A code formatter for Julia with rules set in stone.
MIT License
92 stars 2 forks source link

Runic creates unparsable code in a case with macro on a block #32

Closed KristofferC closed 1 month ago

KristofferC commented 1 month ago
using Runic: format_string

code = """
    f(@m begin
      end)
"""

new_code = format_string(code)

#= 
julia> print(new_code)
    f(
    @m begin
    end,
)
=#

JuliaSyntax.parseall(JuliaSyntax.GreenNode, new_code; version=v"2-")

#=
ERROR: ParseError:
# Error @ line 4:1
    end,
)
╙ ── unexpected `)`
=#

Reduced from this code block https://github.com/JuliaLang/julia/blob/df1976d500914bebd5651bf56c13153f49e153f9/stdlib/REPL/src/LineEdit.jl#L201-L220