summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authorAlan Wu <XrXr@users.noreply.github.com>2024-02-15 20:29:06 -0500
committerAlan Wu <XrXr@users.noreply.github.com>2024-02-16 15:27:49 -0500
commitc4e30d28659fbe0dbe813b21ba8bdbd96c812a66 (patch)
tree3368037ebcf6384aa790e0e8f47c8cd1930416da /test/ruby
parent777c4da0bf41de76a22c4cc67fc93e1404b2930c (diff)
YJIT: Support `**nil`
This adds YJIT support for VM_CALL_KW_SPLAT with nil, specifically for when we already know from the context that it's done with a nil. This is enough to support forwarding with `...` when there no keyword arguments are present. Amend the kw_rest support to propagate the type of the parameter to help with this. Test interactions with splat, since the splat array sits lower on the stack when a kw_splat argument is present.
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_yjit.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/ruby/test_yjit.rb b/test/ruby/test_yjit.rb
index f1b32226ec..b0a8337c11 100644
--- a/test/ruby/test_yjit.rb
+++ b/test/ruby/test_yjit.rb
@@ -1573,6 +1573,17 @@ class TestYJIT < Test::Unit::TestCase
RUBY
end
+ def test_kw_splat_nil
+ assert_compiles(<<~'RUBY', result: %i[ok ok], no_send_fallbacks: true)
+ def id(x) = x
+ def kw_fw(arg, **) = id(arg, **)
+ def fw(...) = id(...)
+ def use = [fw(:ok), kw_fw(:ok)]
+
+ use
+ RUBY
+ end
+
private
def code_gc_helpers