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

ruby-changes:58481

From: Nobuyoshi <ko1@a...>
Date: Tue, 29 Oct 2019 08:59:54 +0900 (JST)
Subject: [ruby-changes:58481] b4229c0a90 (master): Restore `in_kwarg` flag properly

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

From b4229c0a90ef902328e09a92fc5c6e884d01c542 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Tue, 29 Oct 2019 08:58:39 +0900
Subject: Restore `in_kwarg` flag properly


diff --git a/parse.y b/parse.y
index e7fcffa..e1fe38e 100644
--- a/parse.y
+++ b/parse.y
@@ -1557,7 +1557,7 @@ expr		: command_call https://github.com/ruby/ruby/blob/trunk/parse.y#L1557
 		    }
 		  p_top_expr_body
 		    {
-			p->in_kwarg = !!$<num>2;
+			p->in_kwarg = !!$<num>3;
 		    /*%%%*/
 			$$ = NEW_CASE3($1, NEW_IN($4, NEW_TRUE(&@4), NEW_FALSE(&@4), &@4), &@$);
 			rb_warn0L(nd_line($$), "Pattern matching is experimental, and the behavior may change in future versions of Ruby!");
diff --git a/test/ruby/test_pattern_matching.rb b/test/ruby/test_pattern_matching.rb
index cb87529..5283d5c 100644
--- a/test/ruby/test_pattern_matching.rb
+++ b/test/ruby/test_pattern_matching.rb
@@ -1186,6 +1186,7 @@ END https://github.com/ruby/ruby/blob/trunk/test/ruby/test_pattern_matching.rb#L1186
   def test_modifier_in
     assert_equal true, (1 in a)
     assert_equal 1, a
+    assert_valid_syntax "p(({} in a:), a:\n 1)"
   end
 end
 END_of_GUARD
-- 
cgit v0.10.2


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

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