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:
parent
ef03d48cb2
commit
6e70fa49b1
2 changed files with 8 additions and 2 deletions
2
parse.y
2
parse.y
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue