diff options
author | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-01-21 15:59:11 +0000 |
---|---|---|
committer | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-01-21 15:59:11 +0000 |
commit | 83c5b533e36761141ed4dbd9db28e74520cb0ffd (patch) | |
tree | 030f1d8ef14334daf1480af4c347291cdd7e5939 | |
parent | f3ac23e422c1cd68b9be355b82c495047786c268 (diff) |
merge revision(s) r48484: [Backport #10524]
* parse.y (symbol_list): fix the node type of literal symbol list
with no interpolation. [ruby-core:66343]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@49368 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | parse.y | 8 | ||||
-rw-r--r-- | test/ruby/test_literal.rb | 10 | ||||
-rw-r--r-- | version.h | 2 |
4 files changed, 23 insertions, 2 deletions
@@ -1,3 +1,8 @@ +Thu Jan 22 00:54:00 2015 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * parse.y (symbol_list): fix the node type of literal symbol list + with no interpolation. [ruby-core:66343] + Thu Jan 22 00:49:52 2015 Nobuyoshi Nakada <nobu@ruby-lang.org> * object.c: [DOC] Revise documentation by Marcus Stollsteimer at @@ -4033,7 +4033,13 @@ symbol_list : /* none */ { /*%%%*/ $2 = evstr2dstr($2); - nd_set_type($2, NODE_DSYM); + if (nd_type($2) == NODE_DSTR) { + nd_set_type($2, NODE_DSYM); + } + else { + nd_set_type($2, NODE_LIT); + $2->nd_lit = rb_str_intern($2->nd_lit); + } $$ = list_append($1, $2); /*% $$ = dispatch2(symbols_add, $1, $2); diff --git a/test/ruby/test_literal.rb b/test/ruby/test_literal.rb index e4c35e03d9..5fa326acfe 100644 --- a/test/ruby/test_literal.rb +++ b/test/ruby/test_literal.rb @@ -434,4 +434,14 @@ class TestRubyLiteral < Test::Unit::TestCase } end + def test_symbol_list + assert_equal([:foo, :bar], %i[foo bar]) + assert_equal([:"\"foo"], %i["foo]) + + x = 10 + assert_equal([:foo, :b10], %I[foo b#{x}]) + assert_equal([:"\"foo10"], %I["foo#{x}]) + + assert_ruby_status(["--disable-gems", "--dump=parsetree"], "%I[foo bar]") + end end @@ -1,6 +1,6 @@ #define RUBY_VERSION "2.1.5" #define RUBY_RELEASE_DATE "2015-01-22" -#define RUBY_PATCHLEVEL 281 +#define RUBY_PATCHLEVEL 282 #define RUBY_RELEASE_YEAR 2015 #define RUBY_RELEASE_MONTH 1 |