summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--compile.c1
-rw-r--r--test/ruby/test_iseq.rb16
-rw-r--r--version.h2
3 files changed, 17 insertions, 2 deletions
diff --git a/compile.c b/compile.c
index aae9bad9da..40227dc5dc 100644
--- a/compile.c
+++ b/compile.c
@@ -2840,7 +2840,6 @@ remove_unreachable_chunk(rb_iseq_t *iseq, LINK_ELEMENT *i)
break;
}
else if ((lab = find_destination((INSN *)i)) != 0) {
- if (lab->unremovable) break;
unref_counts[lab->label_no]++;
}
}
diff --git a/test/ruby/test_iseq.rb b/test/ruby/test_iseq.rb
index 0b94bf993b..c1de8c96de 100644
--- a/test/ruby/test_iseq.rb
+++ b/test/ruby/test_iseq.rb
@@ -765,4 +765,20 @@ class TestISeq < Test::Unit::TestCase
assert_equal :new, r.take
RUBY
end
+
+ def test_unreachable_pattern_matching
+ assert_in_out_err([], "true or 1 in 1")
+ assert_in_out_err([], "true or (case 1; in 1; 1; in 2; 2; end)")
+ end
+
+ def test_unreachable_pattern_matching_in_if_condition
+ assert_in_out_err([], "#{<<~"begin;"}\n#{<<~'end;'}", %w[1])
+ begin;
+ if true or {a: 0} in {a:}
+ p 1
+ else
+ p a
+ end
+ end;
+ end
end
diff --git a/version.h b/version.h
index 9f6f756be2..a51fea8d0d 100644
--- a/version.h
+++ b/version.h
@@ -11,7 +11,7 @@
# define RUBY_VERSION_MINOR RUBY_API_VERSION_MINOR
#define RUBY_VERSION_TEENY 5
#define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR
-#define RUBY_PATCHLEVEL 212
+#define RUBY_PATCHLEVEL 213
#include "ruby/version.h"
#include "ruby/internal/abi.h"