diff options
-rw-r--r-- | ChangeLog | 11 | ||||
-rw-r--r-- | test/ruby/test_keyword.rb | 20 | ||||
-rw-r--r-- | version.h | 10 | ||||
-rw-r--r-- | vm_insnhelper.c | 2 |
4 files changed, 37 insertions, 6 deletions
@@ -1,3 +1,14 @@ +Mon Jan 18 00:34:41 2016 Koichi Sasada <ko1@atdot.net> + + * vm_insnhelper.c (vm_call_method): should not set fastpath + with keyword arguments for VM_METHOD_TYPE_ATTRSET type methods. + + Normally, we can not use keyword arguments for this kind of methods, + (obj.foo = 1), but we can set alias names for them. + [Bug #11657] + + * test/ruby/test_keyword.rb: add a test for this fix. + Wed Dec 23 06:05:50 2015 Nobuyoshi Nakada <nobu@ruby-lang.org> * parse.y (parser_yylex): allow here documents in labeled diff --git a/test/ruby/test_keyword.rb b/test/ruby/test_keyword.rb index 9c76e15c38..764bd959b1 100644 --- a/test/ruby/test_keyword.rb +++ b/test/ruby/test_keyword.rb @@ -576,4 +576,24 @@ class TestKeywordArguments < Test::Unit::TestCase h = method_for_test_to_hash_call_during_setup_complex_parameters k1: "foo", k2: "bar", sym => "baz" assert_equal ["foo", "bar", {sym => "baz"}], h, '[Bug #11027]' end + + class AttrSetTest + attr_accessor :foo + alias set_foo :foo= + end + + def test_attr_set_method_cache + obj = AttrSetTest.new + h = {a: 1, b: 2} + 2.times{ + obj.foo = 1 + assert_equal(1, obj.foo) + obj.set_foo 2 + assert_equal(2, obj.foo) + obj.set_foo(x: 1, y: 2) + assert_equal({x: 1, y: 2}, obj.foo) + obj.set_foo(x: 1, y: 2, **h) + assert_equal({x: 1, y: 2, **h}, obj.foo) + } + end end @@ -1,10 +1,10 @@ #define RUBY_VERSION "2.2.5" -#define RUBY_RELEASE_DATE "2015-12-23" -#define RUBY_PATCHLEVEL 235 +#define RUBY_RELEASE_DATE "2016-01-18" +#define RUBY_PATCHLEVEL 236 -#define RUBY_RELEASE_YEAR 2015 -#define RUBY_RELEASE_MONTH 12 -#define RUBY_RELEASE_DAY 23 +#define RUBY_RELEASE_YEAR 2016 +#define RUBY_RELEASE_MONTH 1 +#define RUBY_RELEASE_DAY 18 #include "ruby/version.h" diff --git a/vm_insnhelper.c b/vm_insnhelper.c index fae13e82c3..e5c8df6df9 100644 --- a/vm_insnhelper.c +++ b/vm_insnhelper.c @@ -1691,7 +1691,7 @@ vm_call_method(rb_thread_t *th, rb_control_frame_t *cfp, rb_call_info_t *ci) CALLER_SETUP_ARG(cfp, ci); rb_check_arity(ci->argc, 1, 1); ci->aux.index = 0; - CI_SET_FASTPATH(ci, vm_call_attrset, enable_fastpath && !(ci->flag & VM_CALL_ARGS_SPLAT)); + CI_SET_FASTPATH(ci, vm_call_attrset, enable_fastpath && !(ci->flag & VM_CALL_ARGS_SPLAT) && ci->kw_arg == NULL); return vm_call_attrset(th, cfp, ci); } case VM_METHOD_TYPE_IVAR:{ |