diff options
author | John Hawthorn <john@hawthorn.email> | 2021-12-16 10:19:24 -0800 |
---|---|---|
committer | John Hawthorn <john@hawthorn.email> | 2021-12-17 15:26:04 -0800 |
commit | 83aa68447c87169b3610b6e04abebdcc592f0c16 (patch) | |
tree | fec0232c411aaaebde03b319ec0f6c79b08c23aa /test/ruby | |
parent | 5588aa79d4587956ac1ae1734407f21717ad379a (diff) | |
download | ruby-83aa68447c87169b3610b6e04abebdcc592f0c16.tar.gz |
YJIT: Allow iseq with both opt and kwargs
Previously we mirrored the fast paths the interpreter had for having
only one of kwargs or optional args. This commit aims to combine the
cases and reduce complexity.
Though this allows calling iseqs which have have both optional and
keyword arguments, it requires that all optional arguments are specified
when there are keyword arguments, since unspecified optional arguments
appear before the kwargs. Support for this can be added a in a future
PR.
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_yjit.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/ruby/test_yjit.rb b/test/ruby/test_yjit.rb index 227f1be7e7..c0230f7419 100644 --- a/test/ruby/test_yjit.rb +++ b/test/ruby/test_yjit.rb @@ -506,6 +506,17 @@ class TestYJIT < Test::Unit::TestCase RUBY end + def test_optarg_and_kwarg + assert_no_exits(<<~'RUBY') + def opt_and_kwarg(a, b=nil, c: nil) + end + + 2.times do + opt_and_kwarg(1, 2, c: 3) + end + RUBY + end + def test_ctx_different_mappings # regression test simplified from URI::Generic#hostname= assert_compiles(<<~'RUBY', frozen_string_literal: true) |