summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authorRandy Stauner <randy@r4s6.net>2025-12-11 15:56:16 -0700
committerAlan Wu <XrXr@users.noreply.github.com>2025-12-15 23:05:27 -0500
commit9168cad4d63a5d281d443bde4edea6be213b0b25 (patch)
treed54d9a62e9c4c17a25437034750c2de4c539eff5 /test/ruby
parentf3b9509b52bbf845d95bf799d76dad41783919e5 (diff)
YJIT: Bail out if proc would be stored above stack top
Fixes [Bug #21266].
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_yjit.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/ruby/test_yjit.rb b/test/ruby/test_yjit.rb
index ce9dfca390..2096585451 100644
--- a/test/ruby/test_yjit.rb
+++ b/test/ruby/test_yjit.rb
@@ -1772,6 +1772,18 @@ class TestYJIT < Test::Unit::TestCase
RUBY
end
+ def test_proc_block_with_kwrest
+ # When the bug was present this required --yjit-stats to trigger.
+ assert_compiles(<<~RUBY, result: {extra: 5})
+ def foo = bar(w: 1, x: 2, y: 3, z: 4, extra: 5, &proc { _1 })
+ def bar(w:, x:, y:, z:, **kwrest) = yield kwrest
+
+ GC.stress = true
+ foo
+ foo
+ RUBY
+ end
+
private
def code_gc_helpers