Skip to content

collapse_simple_statement collapses functions inside conditionals #898

@PepeElToro41

Description

@PepeElToro41

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions