aboutsummaryrefslogtreecommitdiffstats
path: root/bootstraptest/test_yjit.rb
diff options
context:
space:
mode:
authorAlan Wu <XrXr@users.noreply.github.com>2024-02-28 14:27:16 -0500
committerAlan Wu <XrXr@users.noreply.github.com>2024-02-28 15:00:26 -0500
commit558b58d330783f663d1cfb37c4af7dc330d490b3 (patch)
tree84f0be5ca22bf0e5a0e2d44ac81ca8135c0661b2 /bootstraptest/test_yjit.rb
parent4b92b60f0be3ac4c442f489727310e97741d6bda (diff)
downloadruby-558b58d330783f663d1cfb37c4af7dc330d490b3.tar.gz
YJIT: Reject keywords hash in -1 arity cfunc splat support
`test_keyword.rb` caught this issue. Just need to run with `threshold=1`
Diffstat (limited to 'bootstraptest/test_yjit.rb')
-rw-r--r--bootstraptest/test_yjit.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/bootstraptest/test_yjit.rb b/bootstraptest/test_yjit.rb
index 1d98b92d3a..90f1c0b5f1 100644
--- a/bootstraptest/test_yjit.rb
+++ b/bootstraptest/test_yjit.rb
@@ -4658,3 +4658,19 @@ assert_equal '[[1, 2, 3], [0, 2, 3], [1, 2, 3], [2, 2, 3], [], [], [{}]]', %q{
test_cfunc_vargs_splat(Foo.new, Array, Hash.ruby2_keywords_hash({}))
}
+
+# Class#new (arity=-1), splat, and ruby2_keywords
+assert_equal '[0, {1=>1}]', %q{
+ class KwInit
+ attr_reader :init_args
+ def initialize(x = 0, **kw)
+ @init_args = [x, kw]
+ end
+ end
+
+ def test(klass, args)
+ klass.new(*args).init_args
+ end
+
+ test(KwInit, [Hash.ruby2_keywords_hash({1 => 1})])
+}