summaryrefslogtreecommitdiff
path: root/test/ruby/test_pattern_matching.rb
diff options
context:
space:
mode:
authorNARUSE, Yui <naruse@airemix.jp>2021-02-02 17:50:00 +0900
committerNARUSE, Yui <naruse@airemix.jp>2021-02-02 17:50:00 +0900
commit2dc39e2fd45aacd5fcd33ed80f602bd6f2ddb504 (patch)
tree819703902b7affaa27f88f05fea657ce6d5cc50c /test/ruby/test_pattern_matching.rb
parentfb6cb226a03c2eeaf4fe68b282fcd6e4a8696ffd (diff)
merge revision(s) 1b89b99941548fdb65305dd9a412082e7fdba45a: [Backport #17534]
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 --- compile.c | 2 +- test/ruby/test_pattern_matching.rb | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-)
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