diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2020-03-30 22:11:15 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2020-03-30 22:11:15 +0000 |
commit | 67b77240ee72a401226ffe2127daaf3a65109ee1 (patch) | |
tree | 30f305fa602d91d3d542ca53d52d17c803a2411a | |
parent | fdffe91d462b04b5873fd9be27698998609a0493 (diff) |
merge revision(s) 6e6844320de989cb88a154e2ac75066ccea1bba2: [Backport #16619]
Fixed duplicated warning
As `command_rhs` is always a "value expression", `command_asgn`
does not need the same check.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_5@67868 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | parse.y | 6 | ||||
-rw-r--r-- | test/ruby/test_parse.rb | 6 | ||||
-rw-r--r-- | version.h | 2 |
3 files changed, 7 insertions, 7 deletions
@@ -1511,12 +1511,10 @@ stmt : keyword_alias fitem {SET_LEX_STATE(EXPR_FNAME|EXPR_FITEM);} fitem command_asgn : lhs '=' command_rhs { - value_expr($3); $$ = node_assign($1, $3, &@$); } | var_lhs tOP_ASGN command_rhs { - value_expr($3); $$ = new_op_assign($1, $2, $3, &@$); } | primary_value '[' opt_call_args rbracket tOP_ASGN command_rhs @@ -1524,7 +1522,6 @@ command_asgn : lhs '=' command_rhs /*%%%*/ NODE *args; - value_expr($6); $3 = make_array($3, &@3); args = arg_concat($3, $6, &@$); if ($5 == tOROP) { @@ -1543,12 +1540,10 @@ command_asgn : lhs '=' command_rhs } | primary_value call_op tIDENTIFIER tOP_ASGN command_rhs { - value_expr($5); $$ = new_attr_op_assign($1, $2, $3, $4, $5, &@$); } | primary_value call_op tCONSTANT tOP_ASGN command_rhs { - value_expr($5); $$ = new_attr_op_assign($1, $2, $3, $4, $5, &@$); } | primary_value tCOLON2 tCONSTANT tOP_ASGN command_rhs @@ -1564,7 +1559,6 @@ command_asgn : lhs '=' command_rhs } | primary_value tCOLON2 tIDENTIFIER tOP_ASGN command_rhs { - value_expr($5); $$ = new_attr_op_assign($1, ID2VAL(idCOLON2), $3, $4, $5, &@$); } | backref tOP_ASGN command_rhs diff --git a/test/ruby/test_parse.rb b/test/ruby/test_parse.rb index 15c6245bac..b725634a38 100644 --- a/test/ruby/test_parse.rb +++ b/test/ruby/test_parse.rb @@ -1099,6 +1099,12 @@ x = __ENCODING__ assert_raise(SyntaxError) { eval("def m\n\C-z""end") } end + def test_void_value_in_command_rhs + w = "void value expression" + ex = assert_syntax_error("x = return 1", w) + assert_equal(1, ex.message.scan(w).size, "same #{w.inspect} warning should be just once") + end + =begin def test_past_scope_variable assert_warning(/past scope/) {catch {|tag| eval("BEGIN{throw tag}; tap {a = 1}; a")}} @@ -1,6 +1,6 @@ #define RUBY_VERSION "2.5.8" #define RUBY_RELEASE_DATE "2020-03-31" -#define RUBY_PATCHLEVEL 217 +#define RUBY_PATCHLEVEL 218 #define RUBY_RELEASE_YEAR 2020 #define RUBY_RELEASE_MONTH 3 |