mirror of
https://github.com/ruby/ruby.git
synced 2025-09-15 08:33:58 +02:00
parse.y: required kwarg without parentheses
* parse.y (lex_state_e, parser_params, f_arglist, parser_yylex): separate EXPR_LABELARG from EXPR_BEG and let newline significant, so that required keyword argument can place at the end of argument list without parentheses. [ruby-core:61658] [Bug #9669] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45405 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
0574b64694
commit
d7442c32df
3 changed files with 30 additions and 4 deletions
|
@ -325,6 +325,16 @@ class TestKeywordArguments < Test::Unit::TestCase
|
|||
assert_equal([[:keyreq, :a], [:keyrest, :b]], o.method(:bar).parameters, feature7701)
|
||||
assert_raise_with_message(ArgumentError, /missing keyword/, bug8139) {o.bar(c: bug8139)}
|
||||
assert_raise_with_message(ArgumentError, /missing keyword/, bug8139) {o.bar}
|
||||
|
||||
bug9669 = '[ruby-core:61658] [Bug #9669]'
|
||||
assert_nothing_raised(SyntaxError, bug9669) do
|
||||
eval(<<-'end;', nil, __FILE__, __LINE__)
|
||||
def bug9669.foo a:
|
||||
return a
|
||||
end
|
||||
end;
|
||||
end
|
||||
assert_equal(42, bug9669.foo(a: 42))
|
||||
end
|
||||
|
||||
def test_block_required_keyword
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue