diff options
-rw-r--r-- | compile.c | 2 | ||||
-rw-r--r-- | test/ruby/test_super.rb | 16 | ||||
-rw-r--r-- | version.h | 2 |
3 files changed, 19 insertions, 1 deletions
@@ -5360,7 +5360,9 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *const ret, NODE *node, int poppe 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; diff --git a/test/ruby/test_super.rb b/test/ruby/test_super.rb index 9691116fb4..cf7580ab00 100644 --- a/test/ruby/test_super.rb +++ b/test/ruby/test_super.rb @@ -544,4 +544,20 @@ class TestSuper < Test::Unit::TestCase 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 @@ -1,6 +1,6 @@ #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 |