diff options
| author | Peter Zhu <peter@peterzhu.ca> | 2024-01-26 09:44:09 -0500 |
|---|---|---|
| committer | Peter Zhu <peter@peterzhu.ca> | 2024-01-26 14:58:29 -0500 |
| commit | 3d996e827f2ff74a1bb7e978d754cea7d957b9eb (patch) | |
| tree | 078893b821c4b4d984f30ca887f9844091c5b642 /test/ruby | |
| parent | 99d91838e0daab390d17cbbf90479c9569602488 (diff) | |
[PRISM] Keyword arguments incorrectly passed as mutable
Fixes ruby/prism#2279.
Diffstat (limited to 'test/ruby')
| -rw-r--r-- | test/ruby/test_compile_prism.rb | 10 |
1 files changed, 10 insertions, 0 deletions
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 |
