Skip to content

Always use do/end for multiline lambdas #380

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

Merged

Conversation

etiennebarrie
Copy link
Contributor

Fixes #379

Previously lambda blocks inside a Command/CommandCall were always using braces, even when multiline.

This removes the special handling of multiline lambda blocks, that was forcing curly braces when any of the parents were a Command or CommandCall.

I don't understand why that was there so I can't tell if it's somehow important, but no tests failed and it made the two added fixtures pass.

Previously lambda blocks inside a Command/CommandCall were always using
braces, even when multiline.
@kddnewton
Copy link
Member

For the life of me I can't figure out why that is there.

I think it was in there when the lambda was an argument? As in

foo -> { bar } do end

but that appears to be fine. Maybe it wasn't in 2.6 when I made this? Not sure. Either way, thanks for the PR!

@kddnewton kddnewton merged commit 909b45a into ruby-syntax-tree:main Jun 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Multiline blocks sometimes use braces, sometimes do/end
2 participants