From c42f4d80eabc6b9b4117253a2ba2ee0b9526f253 Mon Sep 17 00:00:00 2001 From: Randy Stauner Date: Fri, 14 Nov 2025 14:50:39 -0700 Subject: ZJIT: Handle caller_kwarg in direct send when all keyword params are required --- test/ruby/test_zjit.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'test/ruby') diff --git a/test/ruby/test_zjit.rb b/test/ruby/test_zjit.rb index 18e10f5206..81d9404070 100644 --- a/test/ruby/test_zjit.rb +++ b/test/ruby/test_zjit.rb @@ -617,6 +617,15 @@ class TestZJIT < Test::Unit::TestCase }, call_threshold: 2 end + def test_send_kwarg_with_too_many_args_to_c_call + assert_compiles '"a b c d {kwargs: :e}"', %q{ + def test(a:, b:, c:, d:, e:) = sprintf("%s %s %s %s %s", a, b, c, d, kwargs: e) + def entry = test(e: :e, d: :d, c: :c, a: :a, b: :b) + entry + entry + }, call_threshold: 2 + end + def test_send_kwrest assert_compiles '{a: 3}', %q{ def test(**kwargs) = kwargs @@ -635,6 +644,15 @@ class TestZJIT < Test::Unit::TestCase }, call_threshold: 2 end + def test_send_req_opt_kwreq + assert_compiles '[[1, 2, 3], [-1, -2, -3]]', %q{ + def test(a, b = 2, c:) = [a, b, c] + def entry = [test(1, c: 3), test(-1, -2, c: -3)] # specify all, change kw order + entry + entry + }, call_threshold: 2 + end + def test_send_req_opt_kwreq_kwopt assert_compiles '[[1, 2, 3, 4], [-1, -2, -3, -4]]', %q{ def test(a, b = 2, c:, d: 4) = [a, b, c, d] -- cgit v1.2.3