From 270a46e392dab13e422b2b9f27f2893a3fecd77b Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Mon, 22 Jan 2024 14:51:12 -0800 Subject: Check keyword parameters correctly We weren't checking the right offsets when compiling methods with keyword parameters that had complex code. Fixes: https://github.com/ruby/prism/issues/2228 --- 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 f54097ab66..328074fc52 100644 --- a/test/ruby/test_compile_prism.rb +++ b/test/ruby/test_compile_prism.rb @@ -1515,6 +1515,11 @@ a CODE end + def test_complex_default_params + assert_prism_eval("def self.foo(a:, b: '2'.to_i); [a, b]; end; foo(a: 1)") + assert_prism_eval("def self.foo(a:, b: 2, c: '3'.to_i); [a, b, c]; end; foo(a: 1)") + end + def test_rescue_with_ensure assert_prism_eval(<<-CODE) begin -- cgit v1.2.3