summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authorAlan Wu <XrXr@users.noreply.github.com>2025-01-04 11:41:00 -0500
committerAlan Wu <XrXr@users.noreply.github.com>2025-01-04 12:53:20 -0500
commitc71addc5227f2f7a04db2b2fb4c14d464639f3f6 (patch)
treee5a1a9e656eabe0508a23c184cd156954036bb9a /test/ruby
parent37356b713ceb0d159f946269c8479854ceb2acee (diff)
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.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/12499
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_yjit.rb8
1 files changed, 8 insertions, 0 deletions
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