From 73690b520da4c3ab680ddc477cacaeaeed75d558 Mon Sep 17 00:00:00 2001 From: Alan Wu Date: Sat, 4 Jan 2025 11:41:00 -0500 Subject: YJIT: Fix crash when yielding keyword arguments Previously, the code for dropping surplus arguments when yielding into blocks erroneously attempted to drop keyword arguments when there is in fact no surplus arguments. Fix the condition and test that supplying the exact number of keyword arguments as require compiles without fallback. --- test/ruby/test_yjit.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'test') diff --git a/test/ruby/test_yjit.rb b/test/ruby/test_yjit.rb index 0c8ed691d0..0e476588f4 100644 --- a/test/ruby/test_yjit.rb +++ b/test/ruby/test_yjit.rb @@ -1742,6 +1742,14 @@ class TestYJIT < Test::Unit::TestCase RUBY end + def test_yield_kwargs + assert_compiles(<<~RUBY, result: 3, no_send_fallbacks: true) + def req2kws = yield a: 1, b: 2 + + req2kws { |a:, b:| a + b } + RUBY + end + private def code_gc_helpers -- cgit v1.2.3