From c8d0bf0156878df03a71fffc97c44abf7333d5d7 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Tue, 3 Mar 2020 15:48:53 +0900 Subject: [PATCH] Preserve `kwarg` flag and fix up f5c904c2a9 --- parse.y | 2 ++ test/ruby/test_pattern_matching.rb | 2 ++ 2 files changed, 4 insertions(+) diff --git a/parse.y b/parse.y index 6b1686e25f..363aea33a0 100644 --- a/parse.y +++ b/parse.y @@ -3964,11 +3964,13 @@ p_expr_basic : p_value | tLBRACE { $$ = push_pktbl(p); + $1 = p->in; p->in.kwarg = 0; } p_kwargs rbrace { pop_pktbl(p, $2); + p->in.kwarg = $1.kwarg; $$ = new_hash_pattern(p, Qnone, $3, &@$); } | tLBRACE rbrace diff --git a/test/ruby/test_pattern_matching.rb b/test/ruby/test_pattern_matching.rb index 3eea523416..3c4314bbe4 100644 --- a/test/ruby/test_pattern_matching.rb +++ b/test/ruby/test_pattern_matching.rb @@ -1060,6 +1060,8 @@ END in {a: 2} false + in a: {b:}, c: + p c in {a: } _a = a