From 53859b791ddc95577e464418725c278e60b02afb Mon Sep 17 00:00:00 2001 From: naruse Date: Fri, 16 Feb 2018 07:32:11 +0000 Subject: [PATCH] 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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_5@62420 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- compile.c | 2 ++ test/ruby/test_super.rb | 16 ++++++++++++++++ version.h | 8 ++++---- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/compile.c b/compile.c index ef6a7cf89c..fb385f9ee6 100644 --- a/compile.c +++ b/compile.c @@ -6181,7 +6181,9 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in 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 diff --git a/version.h b/version.h index b54c8f5a4e..009006e677 100644 --- a/version.h +++ b/version.h @@ -1,10 +1,10 @@ #define RUBY_VERSION "2.5.0" -#define RUBY_RELEASE_DATE "2018-01-30" -#define RUBY_PATCHLEVEL 13 +#define RUBY_RELEASE_DATE "2018-02-16" +#define RUBY_PATCHLEVEL 14 #define RUBY_RELEASE_YEAR 2018 -#define RUBY_RELEASE_MONTH 1 -#define RUBY_RELEASE_DAY 30 +#define RUBY_RELEASE_MONTH 2 +#define RUBY_RELEASE_DAY 16 #include "ruby/version.h"