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

Wrong correction on trailing comma in block argument list #442

Open
bquorning opened this issue Aug 2, 2023 · 0 comments
Open

Wrong correction on trailing comma in block argument list #442

bquorning opened this issue Aug 2, 2023 · 0 comments

Comments

@bquorning
Copy link
Contributor

  • Ruby version: ruby 3.2.2 (2023-03-30 revision e51014f9c0) [arm64-darwin22]
  • Rubyfmt git sha:
$ rubyfmt --version
rubyfmt-main 0.9.5

Input file

foo = [[1, 2], [3, 4]]
foo.each do |bar,|
  p(bar)
end

Rubyfmt's output

foo = [[1, 2], [3, 4]]
foo.each do |bar|
  p(bar)
end

This breaks because

With the block argument list |bar,|, the value of bar inside the block will be 1 and 3.
With the block argument list |bar|, the value of bar inside the block will be [1, 2] and [3, 4].

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

No branches or pull requests

1 participant