[PRISM] Keyword arguments incorrectly passed as mutable
Fixes ruby/prism#2279.
This commit is contained in:
parent
99d91838e0
commit
3d996e827f
@ -1085,7 +1085,6 @@ pm_setup_args(pm_arguments_node_t *arguments_node, int *flags, struct rb_callinf
|
||||
|
||||
if (has_keyword_splat || has_splat) {
|
||||
*flags |= VM_CALL_KW_SPLAT;
|
||||
*flags |= VM_CALL_KW_SPLAT_MUT;
|
||||
|
||||
has_keyword_splat = true;
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user