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

collapse_simple_statement collapses functions inside conditionals #898

Closed
PepeElToro41 opened this issue Oct 4, 2024 · 0 comments · Fixed by #923
Closed

collapse_simple_statement collapses functions inside conditionals #898

PepeElToro41 opened this issue Oct 4, 2024 · 0 comments · Fixed by #923
Labels
bug Something isn't working

Comments

@PepeElToro41
Copy link

If you have collapse_simple_statement for conditionals and you add a function as the statement

if bar then
    return function()
        foo()
    end
end

it will collapse the function as it's considering the function as a simple statement. So it ends up like this:

if bar then return function()
    foo()
end end

This will also happen if the function is provided as an argument

this:

if bar then
     return Array.filter({}, function()
          return true
     end)
end

formats like this:

if bar then return Array.filter({}, function()
     return true
end) end

Probably functions shouldn't be considered as a simple statement

@PepeElToro41 PepeElToro41 changed the title collapse_simple_statement collapses functions too collapse_simple_statement collapses functions inside conditionals Oct 4, 2024
@JohnnyMorganz JohnnyMorganz added the bug Something isn't working label Oct 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants