mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
merge revision(s) 44433: [Backport #9299]
* proc.c: Having any mandatory keyword argument increases min arity [#9299] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@45226 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
038540f931
commit
7a620ac530
4 changed files with 15 additions and 5 deletions
|
|
@ -1,3 +1,8 @@
|
|||
Sat Mar 1 17:25:12 2014 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
|
||||
|
||||
* proc.c: Having any mandatory keyword argument increases min arity
|
||||
[#9299]
|
||||
|
||||
Mon Feb 24 14:56:41 2014 WATANABE Hirofumi <eban@ruby-lang.org>
|
||||
|
||||
* tool/make-snapshot: needs CXXFLAGS. [ruby-core:59393][Bug #9320]
|
||||
|
|
|
|||
2
proc.c
2
proc.c
|
|
@ -828,7 +828,7 @@ rb_iseq_min_max_arity(const rb_iseq_t *iseq, int *max)
|
|||
*max = (iseq->arg_rest == -1 && iseq->arg_keyword == -1) ?
|
||||
iseq->argc + iseq->arg_post_len + iseq->arg_opts - (iseq->arg_opts > 0)
|
||||
: UNLIMITED_ARGUMENTS;
|
||||
return iseq->argc + iseq->arg_post_len;
|
||||
return iseq->argc + iseq->arg_post_len + (iseq->arg_keyword_required > 0);
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
|
|||
|
|
@ -85,6 +85,11 @@ class TestProc < Test::Unit::TestCase
|
|||
assert_equal(-3, proc{|x, y=0, z, **o|}.arity)
|
||||
assert_equal(-3, proc{|x, y=0, *z, w, **o|}.arity)
|
||||
|
||||
assert_equal(2, proc{|x, y=0, z, a:1|}.arity)
|
||||
assert_equal(3, proc{|x, y=0, z, a:|}.arity)
|
||||
assert_equal(-4, proc{|x, y, *rest, a:, b:, c:|}.arity)
|
||||
assert_equal(3, proc{|x, y=0, z, a:, **o|}.arity)
|
||||
|
||||
assert_equal(0, lambda{}.arity)
|
||||
assert_equal(0, lambda{||}.arity)
|
||||
assert_equal(1, lambda{|x|}.arity)
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
#define RUBY_VERSION "2.1.2"
|
||||
#define RUBY_RELEASE_DATE "2014-02-24"
|
||||
#define RUBY_PATCHLEVEL 77
|
||||
#define RUBY_RELEASE_DATE "2014-03-01"
|
||||
#define RUBY_PATCHLEVEL 78
|
||||
|
||||
#define RUBY_RELEASE_YEAR 2014
|
||||
#define RUBY_RELEASE_MONTH 2
|
||||
#define RUBY_RELEASE_DAY 24
|
||||
#define RUBY_RELEASE_MONTH 3
|
||||
#define RUBY_RELEASE_DAY 1
|
||||
|
||||
#include "ruby/version.h"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue