From dc8fb7d97ff0113c738bded825a37b3196eeaaae Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Wed, 24 Jan 2024 11:45:53 -0500 Subject: [PRISM] Fix crash in anonymous block with forwarding arguments Fixes ruby/prism#2262. --- test/ruby/test_compile_prism.rb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'test/ruby') diff --git a/test/ruby/test_compile_prism.rb b/test/ruby/test_compile_prism.rb index bcbd5449e0..b7aa75a5b0 100644 --- a/test/ruby/test_compile_prism.rb +++ b/test/ruby/test_compile_prism.rb @@ -1725,7 +1725,7 @@ end def test_BlockArgumentNode assert_prism_eval("1.then(&:to_s)") - # Test forwarding with no name + # Test anonymous block forwarding assert_prism_eval(<<~RUBY) o = Object.new def o.foo(&) = yield @@ -1733,6 +1733,15 @@ end o.bar { :ok } RUBY + + # Test anonymous block forwarding from argument forwarding + assert_prism_eval(<<~RUBY) + o = Object.new + def o.foo = yield + def o.bar(...) = foo(&) + + o.bar { :ok } + RUBY end def test_BlockLocalVariableNode -- cgit v1.2.3