ruby-changes:50701
From: nagachika <ko1@a...>
Date: Wed, 21 Mar 2018 03:07:31 +0900 (JST)
Subject: [ruby-changes:50701] nagachika:r62868 (ruby_2_4): merge revision(s) 61603: [Backport #14279]
nagachika 2018-03-21 03:07:27 +0900 (Wed, 21 Mar 2018) New Revision: 62868 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=62868 Log: merge revision(s) 61603: [Backport #14279] check array for zsuper. [Bug #14279] * compile.c (iseq_compile_each0): for zsuper (NODE_ZSUPER), we need to check given argument is Array or not. * test/ruby/test_super.rb: add a test for this bug. Modified directories: branches/ruby_2_4/ Modified files: branches/ruby_2_4/compile.c branches/ruby_2_4/test/ruby/test_super.rb branches/ruby_2_4/version.h Index: ruby_2_4/compile.c =================================================================== --- ruby_2_4/compile.c (revision 62867) +++ ruby_2_4/compile.c (revision 62868) @@ -5360,7 +5360,9 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ https://github.com/ruby/ruby/blob/trunk/ruby_2_4/compile.c#L5360 if (liseq->body->param.flags.has_rest) { /* rest argument */ int idx = liseq->body->local_table_size - liseq->body->param.rest_start; + ADD_GETLOCAL(args, line, idx, lvar_level); + ADD_INSN1(args, line, splatarray, Qfalse); argc = liseq->body->param.rest_start + 1; flag |= VM_CALL_ARGS_SPLAT; Index: ruby_2_4/version.h =================================================================== --- ruby_2_4/version.h (revision 62867) +++ ruby_2_4/version.h (revision 62868) @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_4/version.h#L1 #define RUBY_VERSION "2.4.4" #define RUBY_RELEASE_DATE "2018-03-21" -#define RUBY_PATCHLEVEL 276 +#define RUBY_PATCHLEVEL 277 #define RUBY_RELEASE_YEAR 2018 #define RUBY_RELEASE_MONTH 3 Index: ruby_2_4/test/ruby/test_super.rb =================================================================== --- ruby_2_4/test/ruby/test_super.rb (revision 62867) +++ ruby_2_4/test/ruby/test_super.rb (revision 62868) @@ -544,4 +544,20 @@ class TestSuper < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_4/test/ruby/test_super.rb#L544 c.new } end + + class TestFor_super_with_modified_rest_parameter_base + def foo *args + args + end + end + + class TestFor_super_with_modified_rest_parameter < TestFor_super_with_modified_rest_parameter_base + def foo *args + args = 13 + super + end + end + def test_super_with_modified_rest_parameter + assert_equal [13], TestFor_super_with_modified_rest_parameter.new.foo + end end Index: ruby_2_4 =================================================================== --- ruby_2_4 (revision 62867) +++ ruby_2_4 (revision 62868) Property changes on: ruby_2_4 ___________________________________________________________________ Modified: svn:mergeinfo ## -0,0 +0,1 ## Merged /trunk:r61603 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/