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

for a in [] < confuses the formatter #465

Closed
Volker-Weissmann opened this issue Aug 31, 2021 · 1 comment
Closed

for a in [] < confuses the formatter #465

Volker-Weissmann opened this issue Aug 31, 2021 · 1 comment
Labels
bug Something isn't working cstparser

Comments

@Volker-Weissmann
Copy link

Volker-Weissmann commented Aug 31, 2021

The following code executes just fine, but this project is unable to format it

function weird()
    begin
        # notice the trailing "<"
        for a in [] <
        end
        end
        println(321)
    end
function badly_formatted()
         if 2 == 2
    println(123)
             end
end
weird()
badly_formatted()
julia> format("bug6.jl")
ERROR: Parsing error for input occurred on line 15, offset: 16
Stacktrace:
  [1] format_text(text::String, style::DefaultStyle, opts::JuliaFormatter.Options)
    @ JuliaFormatter ~/.julia/packages/JuliaFormatter/uYD8A/src/JuliaFormatter.jl:344
  [2] #format_text#171
    @ ~/.julia/packages/JuliaFormatter/uYD8A/src/JuliaFormatter.jl:338 [inlined]
  [3] format_text
    @ ~/.julia/packages/JuliaFormatter/uYD8A/src/JuliaFormatter.jl:336 [inlined]
  [4] #format_text#170
    @ ~/.julia/packages/JuliaFormatter/uYD8A/src/JuliaFormatter.jl:332 [inlined]
  [5] format_text
    @ ~/.julia/packages/JuliaFormatter/uYD8A/src/JuliaFormatter.jl:332 [inlined]
  [6] format_file(filename::String; overwrite::Bool, verbose::Bool, format_markdown::Bool, format_options::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ JuliaFormatter ~/.julia/packages/JuliaFormatter/uYD8A/src/JuliaFormatter.jl:457
  [7] format_file
    @ ~/.julia/packages/JuliaFormatter/uYD8A/src/JuliaFormatter.jl:447 [inlined]
  [8] format(paths::Tuple{String}; options::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ JuliaFormatter ~/.julia/packages/JuliaFormatter/uYD8A/src/JuliaFormatter.jl:524
  [9] format
    @ ~/.julia/packages/JuliaFormatter/uYD8A/src/JuliaFormatter.jl:500 [inlined]
 [10] #format#180
    @ ~/.julia/packages/JuliaFormatter/uYD8A/src/JuliaFormatter.jl:549 [inlined]
 [11] format(path::String)
    @ JuliaFormatter ~/.julia/packages/JuliaFormatter/uYD8A/src/JuliaFormatter.jl:549
 [12] top-level scope
    @ REPL[3]:1
@domluna
Copy link
Owner

domluna commented May 17, 2022

Meta.parse handles this by just throwing away the extra token. CSTParser.jl has decided not to do this (which will cause an error) and since we rely on it this type of syntax won't be supported for formatting therefore I'm going to close this since there's nothing to be done.

@domluna domluna closed this as completed May 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cstparser
Projects
None yet
Development

No branches or pull requests

2 participants