Bug #5989

Keyword spash is syntax error when there are no explicit keyword arguments

Added by Yura Sokolov over 3 years ago. Updated about 3 years ago.

[ruby-core:42455]
Status:Closed
Priority:Normal
Assignee:Yusuke Endoh
ruby -v:ruby 2.0.0dev (2012-02-09 trunk 34505) [i686-linux] Backport:

Description

$ ruby -e 'def a(a:1, **h); p h; end; a(b: 1)'
{:b=>1}
$ ruby -e 'def a(**h); p h; end; a(b: 1)'
-e:1: syntax error, unexpected tPOW, expecting ')'
def a(**h); p h; end
        ^

Associated revisions

Revision 34998
Added by Nobuyoshi Nakada about 3 years ago

  • parse.y (block_param, f_args): add rules for the case arguments begin with kwrest. [Bug #5989]

Revision 34998
Added by Nobuyoshi Nakada about 3 years ago

  • parse.y (block_param, f_args): add rules for the case arguments begin with kwrest. [Bug #5989]

Revision 34999
Added by Nobuyoshi Nakada about 3 years ago

  • compile.c (iseq_set_arguments): keyword rest arg without keyword args.
  • node.c (dump_node): dump kw_rest_arg too.
  • parse.y (block_param, f_arg): more kwrest patterns. [Bug #5989]
  • parse.y (new_args_gen): no extra kw_rest_arg if no keyword rest arg.

Revision 34999
Added by Nobuyoshi Nakada about 3 years ago

  • compile.c (iseq_set_arguments): keyword rest arg without keyword args.
  • node.c (dump_node): dump kw_rest_arg too.
  • parse.y (block_param, f_arg): more kwrest patterns. [Bug #5989]
  • parse.y (new_args_gen): no extra kw_rest_arg if no keyword rest arg.

History

#1 Updated by Koichi Sasada about 3 years ago

  • Assignee set to Yusuke Endoh

#2 Updated by Nobuyoshi Nakada about 3 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r34998.
Yura, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


  • parse.y (block_param, f_args): add rules for the case arguments begin with kwrest. [Bug #5989]

#3 Updated by Nobuyoshi Nakada about 3 years ago

  • Status changed from Closed to Open
  • % Done changed from 100 to 20

#4 Updated by Nobuyoshi Nakada about 3 years ago

  • Status changed from Open to Closed
  • % Done changed from 20 to 100

This issue was solved with changeset r34999.
Yura, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


  • compile.c (iseq_set_arguments): keyword rest arg without keyword args.
  • node.c (dump_node): dump kw_rest_arg too.
  • parse.y (block_param, f_arg): more kwrest patterns. [Bug #5989]
  • parse.y (new_args_gen): no extra kw_rest_arg if no keyword rest arg.

Also available in: Atom PDF