From 75aeb225b8558ff908ea78bf608dfbba09bdc2f9 Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Sat, 18 Jul 2026 13:50:21 -0700 Subject: [PATCH] Also output mandatory only ISEQ in dumps Methods with mandatory only support only dumps the ISEQ of the case with all the arguments and not the mandatory only case. This commit changes it to also dump the mandatory only ISEQ. --- iseq.c | 4 ++++ test/ruby/test_iseq.rb | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/iseq.c b/iseq.c index 93e58db2e65..f2db484f59f 100644 --- a/iseq.c +++ b/iseq.c @@ -3002,6 +3002,10 @@ rb_iseq_disasm_recursive(const rb_iseq_t *iseq, VALUE indent) n += rb_iseq_disasm_insn(str, code, n, iseq, child); } + if (body->mandatory_only_iseq) { + rb_ary_push(child, (VALUE)body->mandatory_only_iseq); + } + for (l = 0; l < RARRAY_LEN(child); l++) { VALUE isv = rb_ary_entry(child, l); if (done_iseq && st_is_member(done_iseq, (st_data_t)isv)) continue; diff --git a/test/ruby/test_iseq.rb b/test/ruby/test_iseq.rb index 30931587f8b..0a06d01b08a 100644 --- a/test/ruby/test_iseq.rb +++ b/test/ruby/test_iseq.rb @@ -524,6 +524,12 @@ class TestISeq < Test::Unit::TestCase assert_equal [:&], param_names end + def test_disasm_mandatory_only_overloaded + disasm = RubyVM::InstructionSequence.disasm(Time.method(:at)) + assert_include disasm, "" + assert_include disasm, "" + end + def strip_lineno(source) source.gsub(/^.*?: /, "") end