From dbd76d9101cfb35b483ad5e173fc153102c9d03e Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Mon, 22 Jan 2024 11:43:00 -0500 Subject: [PRISM] Fix keyword splat in IndexAndWriteNode and IndexOrWriteNode Fixes ruby/prism#2232 and ruby/prism#2234. --- test/ruby/test_compile_prism.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'test/ruby') diff --git a/test/ruby/test_compile_prism.rb b/test/ruby/test_compile_prism.rb index 0998c8fa5d..8f42fb5851 100644 --- a/test/ruby/test_compile_prism.rb +++ b/test/ruby/test_compile_prism.rb @@ -394,6 +394,15 @@ module Prism h[foo: 1] &&= 2 RUBY + + # Test with keyword splat + assert_prism_eval(<<~RUBY) + h = Object.new + def h.[](**b) = 1 + def h.[]=(*a, **b); end + + h[**{}] &&= 2 + RUBY end def test_IndexOrWriteNode @@ -415,6 +424,15 @@ module Prism hash["key", &(Proc.new { _1.upcase })] ||= "value" hash CODE + + # Test with keyword splat + assert_prism_eval(<<~RUBY) + h = Object.new + def h.[](**b) = nil + def h.[]=(*a, **b); end + + h[**{}] ||= 2 + RUBY end def test_IndexOperatorWriteNode -- cgit v1.2.3