summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPeter Zhu <peter@peterzhu.ca>2024-01-29 09:47:52 -0500
committerPeter Zhu <peter@peterzhu.ca>2024-01-29 11:42:40 -0500
commit9a5a11f3d0e5d9b595d51aafe8fdadfe384568ad (patch)
tree7706b2c19072ce6574a3b962f373b8f318166767 /test
parente050097bebe64e86e97e915fa74a3fc010c588e8 (diff)
[PRISM] Use the splatkw instruction
Fixes ruby/prism#2272.
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_compile_prism.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/ruby/test_compile_prism.rb b/test/ruby/test_compile_prism.rb
index ff0a252b71..93dcd42450 100644
--- a/test/ruby/test_compile_prism.rb
+++ b/test/ruby/test_compile_prism.rb
@@ -827,6 +827,28 @@ module Prism
o.bar(hello: "world")
RUBY
+
+ # Test that AssocSplatNode is evaluated before BlockArgumentNode using
+ # the splatkw instruction
+ assert_prism_eval(<<~RUBY)
+ o = Struct.new(:ary) do
+ def to_hash
+ ary << :to_hash
+ {}
+ end
+
+ def to_proc
+ ary << :to_proc
+ -> {}
+ end
+
+ def t(...); end
+ end.new
+ o.ary = []
+
+ o.t(**o, &o)
+ o.ary
+ RUBY
end
def test_HashNode