Bug #7540

Proc#parameters cannot show :opt with :rest and :keyword

Added by Nobuhiro IMAI over 2 years ago. Updated over 2 years ago.

[ruby-core:50735]
Status:Closed
Priority:Normal
Assignee:Benoit Daloze
ruby -v:ruby 2.0.0dev (2012-12-10 trunk 38297) [x86_64-linux] Backport:

Description

When an :opt arg is specified with :rest and :key args,
Proc#parameters (as well as *Method) cannot show it as below:

->(opt = :ion, *rest, key: :word){}.parameters # => [[:rest, :rest], [:key, :key]]

Associated revisions

Revision 38333
Added by Benoit Daloze over 2 years ago

  • iseq.c (rb_iseq_parameters): fix limit for optional arguments.
  • test/ruby/test_keyword.rb: tests for above.
  • vm_core.h (struct rb_iseq_struct): update documentation with keyword arguments. [Bug #7540]

Revision 38333
Added by Benoit Daloze over 2 years ago

  • iseq.c (rb_iseq_parameters): fix limit for optional arguments.
  • test/ruby/test_keyword.rb: tests for above.
  • vm_core.h (struct rb_iseq_struct): update documentation with keyword arguments. [Bug #7540]

History

#1 Updated by Benoit Daloze over 2 years ago

I've started to take a look at this, and I wish to solve it if I find the way.
But of course if I'm taking too much time or somebody solves it before it's fine,
although I would prefer collaborating with them (I suppose mame, as he did r34137).

#2 Updated by Benoit Daloze over 2 years ago

  • Assignee set to Benoit Daloze

Found the fix, just taking time to update related documentation.

no6v: nice catch!

#3 Updated by Benoit Daloze over 2 years ago

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

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


  • iseq.c (rb_iseq_parameters): fix limit for optional arguments.
  • test/ruby/test_keyword.rb: tests for above.
  • vm_core.h (struct rb_iseq_struct): update documentation with keyword arguments. [Bug #7540]

#4 Updated by Nobuhiro IMAI over 2 years ago

Cool! We are lucky to find this, and then fixed. Thanks :).

Also available in: Atom PDF