1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Disallow omission of parentheses/brackets in single line pattern matching [Feature #16182]

This commit is contained in:
Kazuki Tsujimoto 2019-11-10 22:34:49 +09:00
parent ef03d48cb2
commit 6e70fa49b1
No known key found for this signature in database
GPG key ID: BCEA306C49B81CD7
2 changed files with 8 additions and 2 deletions

View file

@ -1569,7 +1569,7 @@ expr : command_call
$<tbl>$ = p->pvtbl;
p->pvtbl = st_init_numtable();
}
p_top_expr_body
p_expr
{
st_free_table(p->pvtbl);
p->pvtbl = $<tbl>4;

View file

@ -1261,7 +1261,13 @@ END
def test_modifier_in
assert_equal true, (1 in a)
assert_equal 1, a
assert_valid_syntax "p(({} in a:), a:\n 1)"
assert_valid_syntax "p(({} in {a:}), a:\n 1)"
assert_syntax_error(%q{
1 in a, b
}, /unexpected/, '[ruby-core:95098]')
assert_syntax_error(%q{
1 in a:
}, /unexpected/, '[ruby-core:95098]')
end
end
END_of_GUARD