summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authorAlan Wu <XrXr@users.noreply.github.com>2023-08-23 11:10:52 -0400
committerGitHub <noreply@github.com>2023-08-23 11:10:52 -0400
commitb4bc047f2f20d84ffce0ab3a4c7f5c5e9f6eb0b7 (patch)
treec31dfbd39a16a677cc1161b7aa6c7eb399b0209d /test/ruby
parentf902df128dea9044c226ed88306fca4d3a26f623 (diff)
YJIT: Implement VM_CALL_ARGS_BLOCKARG with Proc for ISeq calls
Rack uses this. Speculate that the `obj` in `the_call(&obj)` will be a proc when the compile-time sample is a proc. Co-authored-by: Takashi Kokubun <takashikkbn@gmail.com> Co-authored-by: Maxime Chevalier-Boisvert <maxime.chevalierboisvert@shopify.com> Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/8117 Merged-By: XrXr
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_yjit.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/ruby/test_yjit.rb b/test/ruby/test_yjit.rb
index 0207f4aaf1..5347028550 100644
--- a/test/ruby/test_yjit.rb
+++ b/test/ruby/test_yjit.rb
@@ -1320,6 +1320,16 @@ class TestYJIT < Test::Unit::TestCase
RUBY
end
+ def test_proc_block_arg
+ assert_compiles(<<~RUBY, result: [:proc, :no_block])
+ def yield_if_given = block_given? ? yield : :no_block
+
+ def call(block_arg = nil) = yield_if_given(&block_arg)
+
+ [call(-> { :proc }), call]
+ RUBY
+ end
+
private
def code_gc_helpers