Fix wrong unreachable chunk remove when jump destination label is unremovable
This commit is contained in:
parent
77f8107efa
commit
1870505f47
Notes:
git
2024-07-30 06:32:16 +00:00
Merged: https://github.com/ruby/ruby/pull/11267 Merged-By: nobu <nobu@ruby-lang.org>
@ -3054,7 +3054,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]++;
|
||||
}
|
||||
}
|
||||
|
@ -813,6 +813,11 @@ class TestISeq < Test::Unit::TestCase
|
||||
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:}
|
||||
|
Loading…
x
Reference in New Issue
Block a user