From 01850584a38490713ee70f8f6b92e04f5bc4d6d1 Mon Sep 17 00:00:00 2001 From: Reese Williams Date: Thu, 11 Jun 2026 09:47:37 -0500 Subject: [PATCH 1/2] Fixtures --- fixtures/small/anonymous_blockarg_actual.rb | 22 +++++++++++++++++++ fixtures/small/anonymous_blockarg_expected.rb | 22 +++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/fixtures/small/anonymous_blockarg_actual.rb b/fixtures/small/anonymous_blockarg_actual.rb index 2ce2f4ad6..4d1fce92e 100644 --- a/fixtures/small/anonymous_blockarg_actual.rb +++ b/fixtures/small/anonymous_blockarg_actual.rb @@ -1,3 +1,25 @@ def foo(a, b, &) bar a, b, & end + +def foo( + a, + & +) + bar( + a, + &) +end + +def foo( + a, + *b, + & +) +bar( + a, + b, + & + ) +end + diff --git a/fixtures/small/anonymous_blockarg_expected.rb b/fixtures/small/anonymous_blockarg_expected.rb index 741c607a2..2f24638a1 100644 --- a/fixtures/small/anonymous_blockarg_expected.rb +++ b/fixtures/small/anonymous_blockarg_expected.rb @@ -1,3 +1,25 @@ def foo(a, b, &) bar(a, b, &) end + +def foo( + a, + & +) + bar( + a, + & + ) +end + +def foo( + a, + *b, + & +) + bar( + a, + b, + & + ) +end From 9202b881487b5270882bbe81ddac2fdc902bf3f6 Mon Sep 17 00:00:00 2001 From: Reese Williams Date: Thu, 11 Jun 2026 09:52:17 -0500 Subject: [PATCH 2/2] Emit `at_offset` for anonymous block args --- librubyfmt/src/format_prism.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/librubyfmt/src/format_prism.rs b/librubyfmt/src/format_prism.rs index d27e4bf61..0b2b1b8ce 100644 --- a/librubyfmt/src/format_prism.rs +++ b/librubyfmt/src/format_prism.rs @@ -1639,6 +1639,8 @@ fn format_block_parameter_node<'src>( let ident_str = ident.as_slice(); ps.bind_variable(ident_str); handle_string_at_offset(ps, ident_str, block_arg.name_loc().unwrap().end_offset()); + } else { + ps.at_offset(block_arg.location().start_offset()); } }); }