diff options
-rw-r--r-- | parse.y | 2 | ||||
-rw-r--r-- | test/ruby/test_pattern_matching.rb | 5 |
2 files changed, 5 insertions, 2 deletions
@@ -1571,7 +1571,7 @@ expr : command_call { p->in_kwarg = !!$<num>3; /*%%%*/ - $$ = NEW_CASE3($1, NEW_IN($5, NEW_TRUE(&@5), NEW_FALSE(&@5), &@5), &@$); + $$ = NEW_CASE3($1, NEW_IN($5, 0, 0, &@5), &@$); rb_warn0L(nd_line($$), "Pattern matching is experimental, and the behavior may change in future versions of Ruby!"); /*% %*/ /*% ripper: case!($1, in!($5, Qnil, Qnil)) %*/ diff --git a/test/ruby/test_pattern_matching.rb b/test/ruby/test_pattern_matching.rb index 889f8dd519..50bab51bfa 100644 --- a/test/ruby/test_pattern_matching.rb +++ b/test/ruby/test_pattern_matching.rb @@ -1261,8 +1261,11 @@ END ################################################################ def test_modifier_in - assert_equal true, (1 in a) + assert_nil (1 in a) assert_equal 1, a + assert_raise(NoMatchingPatternError) do + {a: 1} in {a: 0} + end assert_valid_syntax "p(({} in {a:}), a:\n 1)" assert_syntax_error(%q{ 1 in a, b |