From 3d996e827f2ff74a1bb7e978d754cea7d957b9eb Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Fri, 26 Jan 2024 09:44:09 -0500 Subject: [PRISM] Keyword arguments incorrectly passed as mutable Fixes ruby/prism#2279. --- test/ruby/test_compile_prism.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'test/ruby') diff --git a/test/ruby/test_compile_prism.rb b/test/ruby/test_compile_prism.rb index 4ccea6d319..05e95e8b06 100644 --- a/test/ruby/test_compile_prism.rb +++ b/test/ruby/test_compile_prism.rb @@ -2134,6 +2134,16 @@ end def test_KeywordRestParameterNode assert_prism_eval("def prism_test_keyword_rest_parameter_node(a, **b); end") assert_prism_eval("Object.tap { |**| }") + + # Test that KeywordRestParameterNode creates a copy + assert_prism_eval(<<~RUBY) + hash = {} + o = Object.new + def o.foo(**a) = a[:foo] = 1 + + o.foo(**hash) + hash + RUBY end def test_NoKeywordsParameterNode -- cgit v1.2.3