[前][次][番号順一覧][スレッド一覧]

ruby-changes:56080

From: Nobuyoshi <ko1@a...>
Date: Tue, 11 Jun 2019 22:38:49 +0900 (JST)
Subject: [ruby-changes:56080] Nobuyoshi Nakada: 39ae88ad0d (trunk): Refined syntax error messages

https://git.ruby-lang.org/ruby.git/commit/?id=39ae88ad0d

From 39ae88ad0dd0f8d7cf732e8567af13e7f2ce9748 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Tue, 11 Jun 2019 22:31:57 +0900
Subject: Refined syntax error messages


diff --git a/parse.y b/parse.y
index bf6c726..c78f513 100644
--- a/parse.y
+++ b/parse.y
@@ -1788,7 +1788,7 @@ mlhs_node	: user_variable https://github.com/ruby/ruby/blob/trunk/parse.y#L1788
 		| primary_value call_op tIDENTIFIER
 		    {
 			if ($2 == tANDDOT) {
-			    yyerror1(&@2, "&. inside LHS of multiple assignment");
+			    yyerror1(&@2, "&. inside multiple assignment destination");
 			}
 		    /*%%%*/
 			$$ = attrset(p, $1, $2, $3, &@$);
@@ -1805,7 +1805,7 @@ mlhs_node	: user_variable https://github.com/ruby/ruby/blob/trunk/parse.y#L1805
 		| primary_value call_op tCONSTANT
 		    {
 			if ($2 == tANDDOT) {
-			    yyerror1(&@2, "&. inside LHS of multiple assignment");
+			    yyerror1(&@2, "&. inside multiple assignment destination");
 			}
 		    /*%%%*/
 			$$ = attrset(p, $1, $2, $3, &@$);
diff --git a/test/ruby/test_syntax.rb b/test/ruby/test_syntax.rb
index 8112b14..f2fcf67 100644
--- a/test/ruby/test_syntax.rb
+++ b/test/ruby/test_syntax.rb
@@ -977,8 +977,8 @@ eom https://github.com/ruby/ruby/blob/trunk/test/ruby/test_syntax.rb#L977
   end
 
   def test_safe_call_in_massign_lhs
-    assert_syntax_error("*a&.x=0", /LHS/)
-    assert_syntax_error("a&.x,=0", /LHS/)
+    assert_syntax_error("*a&.x=0", /multiple assignment destination/)
+    assert_syntax_error("a&.x,=0", /multiple assignment destination/)
   end
 
   def test_no_warning_logop_literal
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]