diff options
-rw-r--r-- | parse.y | 4 | ||||
-rw-r--r-- | test/ruby/test_pattern_matching.rb | 9 |
2 files changed, 13 insertions, 0 deletions
@@ -4053,6 +4053,10 @@ p_kwargs : p_kwarg ',' p_kwrest { $$ = new_hash_pattern_tail(p, new_unique_key_hash(p, $1, &@$), 0, &@$); } + | p_kwarg ',' + { + $$ = new_hash_pattern_tail(p, new_unique_key_hash(p, $1, &@$), 0, &@$); + } | p_kwrest { $$ = new_hash_pattern_tail(p, new_hash(p, Qnone, &@$), $1, &@$); diff --git a/test/ruby/test_pattern_matching.rb b/test/ruby/test_pattern_matching.rb index 6dbb25ca86..a3b7dcfd18 100644 --- a/test/ruby/test_pattern_matching.rb +++ b/test/ruby/test_pattern_matching.rb @@ -1042,6 +1042,15 @@ END end end + assert_block do + case {a: 0, b: 1} + in {a: 1,} + false + in {a:,} + true + end + end + assert_syntax_error(%q{ case _ in "a-b": |