aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_pattern_matching.rb
diff options
context:
space:
mode:
authorVladimir Dementyev <dementiev.vm@gmail.com>2021-01-19 00:00:52 +0300
committerNobuyoshi Nakada <nobu@ruby-lang.org>2021-01-19 08:34:01 +0900
commit1b89b99941548fdb65305dd9a412082e7fdba45a (patch)
tree4102d063972f25d65807a257efdad73c4a8fb7bc /test/ruby/test_pattern_matching.rb
parent9d1475c621af671494769dde5a09db4c86071474 (diff)
downloadruby-1b89b99941548fdb65305dd9a412082e7fdba45a.tar.gz
Mark pattern labels as unremoveable
Peephole optimization doesn't play well with find pattern at least. The only case when a pattern matching could have unreachable patterns is when we have lasgn/dasgn node, which shouldn't happen in real-life. Fixes https://bugs.ruby-lang.org/issues/17534
Diffstat (limited to 'test/ruby/test_pattern_matching.rb')
-rw-r--r--test/ruby/test_pattern_matching.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/ruby/test_pattern_matching.rb b/test/ruby/test_pattern_matching.rb
index 243a4cd2bd..e4c7507ac4 100644
--- a/test/ruby/test_pattern_matching.rb
+++ b/test/ruby/test_pattern_matching.rb
@@ -791,6 +791,16 @@ END
true
end
end
+
+ # https://bugs.ruby-lang.org/issues/17534
+ assert_block do
+ case [0, 1, 2]
+ in x
+ true
+ in [*, 2, *]
+ false
+ end
+ end
end
def test_hash_pattern