From 90ae8eaecae00eabd2d7dc8ec7ee1afc53a6bd9d Mon Sep 17 00:00:00 2001 From: Alan Wu Date: Thu, 1 Feb 2024 18:31:42 -0500 Subject: [PRISM] Fix numbered parameters stealing local names Previously, the local index of numbered parameters were assigned to names of regular locals, making it hard to read both of them. Use proper `_[1-9]` numbered parameters. This fixes `test_shapes.rb`. Also, properly mark the iseq as having lead parameters. --- test/ruby/test_compile_prism.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'test/ruby') diff --git a/test/ruby/test_compile_prism.rb b/test/ruby/test_compile_prism.rb index a66213c442..b9c8d1bb5b 100644 --- a/test/ruby/test_compile_prism.rb +++ b/test/ruby/test_compile_prism.rb @@ -1721,6 +1721,11 @@ a assert_prism_eval("def self.foo(a:, b: 2, c: '3'.to_i); [a, b, c]; end; foo(a: 1)") end + def test_numbered_params + assert_prism_eval("[1, 2, 3].then { _3 }") + assert_prism_eval("1.then { one = 1; one + _1 }") + end + def test_rescue_with_ensure assert_prism_eval(<<-CODE) begin -- cgit v1.2.3