diff options
| author | Alan Wu <XrXr@users.noreply.github.com> | 2024-01-31 16:22:27 -0500 |
|---|---|---|
| committer | Alan Wu <XrXr@users.noreply.github.com> | 2024-02-01 10:33:54 -0500 |
| commit | 1f226b41f04a88062952dcd11c6a97381fa7e510 (patch) | |
| tree | 58f221e9970f5a9d329073b62002446edbbd6ba3 /test/ruby | |
| parent | 8531ac3115877023a907a4365ca76a7bf14fec20 (diff) | |
[PRISM] Fix multiple return with splat and splat+kwsplat
Previously, `return *array, 1` didn't behave like `return [*array, 1]`
properly. Also, it crashed when splat and kwsplat is combined like in
`array = [*things, **hash]`.
Fix this by grouping `PM_ARGUMENTS_NODE` with `PM_ARRAY_NODE` handling and
combining splat and kwsplat handling.
Diffstat (limited to 'test/ruby')
| -rw-r--r-- | test/ruby/test_compile_prism.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/test/ruby/test_compile_prism.rb b/test/ruby/test_compile_prism.rb index d004eb9ce7..aecb223bcc 100644 --- a/test/ruby/test_compile_prism.rb +++ b/test/ruby/test_compile_prism.rb @@ -1486,6 +1486,13 @@ a end prism_test_return_node CODE + + assert_prism_eval(<<-CODE) + def self.prism_test_return_node(*args, **kwargs) + return *args, *args, **kwargs + end + prism_test_return_node(1, foo: 0) + CODE end ############################################################################ |
