diff options
| author | Ufuk Kayserilioglu <ufuk.kayserilioglu@shopify.com> | 2023-12-14 20:15:30 +0200 |
|---|---|---|
| committer | Jemma Issroff <jemmaissroff@gmail.com> | 2023-12-14 14:08:37 -0500 |
| commit | d07fdc5edee219bbbd6262f909d636a509793cca (patch) | |
| tree | 85338675851fa393ce793407dc66c4704bfb9825 /test/ruby | |
| parent | 295d97ab4dc826a4c2b812d254a6607c87534ed7 (diff) | |
[PRISM] Fix keyword hash handling in method calls
* Start using the renamed `PM_KEYWORD_HASH_NODE_FLAGS_SYMBOL_KEYS` flag
to check if all keys of the keyword hash node are symbols.
* For arguments passed as a hash, start marking them as `KW_SPLAT_MUT` only if the number of entries in the hash is greater than 1 (which is what the old compiler used to do).
Diffstat (limited to 'test/ruby')
| -rw-r--r-- | test/ruby/test_compile_prism.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/ruby/test_compile_prism.rb b/test/ruby/test_compile_prism.rb index e01344ccc5..6b16205869 100644 --- a/test/ruby/test_compile_prism.rb +++ b/test/ruby/test_compile_prism.rb @@ -1448,6 +1448,18 @@ module Prism CODE assert_prism_eval(<<-CODE) + def self.foo(*args, **kwargs) = [args, kwargs] + + [ + foo(2 => 3), + foo([] => 42), + foo(a: 42, b: 61), + foo(1, 2, 3, a: 42, "b" => 61), + foo(:a => 42, :b => 61), + ] + CODE + + assert_prism_eval(<<-CODE) class PrivateMethod def initialize self.instance_var |
