diff --git a/bootstraptest/test_method.rb b/bootstraptest/test_method.rb index f6f04541d6..41823b5007 100644 --- a/bootstraptest/test_method.rb +++ b/bootstraptest/test_method.rb @@ -1395,3 +1395,27 @@ assert_equal 'ok', %q{ no_args splat_args } + +assert_equal 'ok', %q{ + class A + private + def foo = "ng" + end + + class B + def initialize(o) + @o = o + end + + def foo(...) = @o.foo(...) + def internal_foo = foo + end + + b = B.new(A.new) + + begin + b.internal_foo + rescue NoMethodError + "ok" + end +} diff --git a/vm_args.c b/vm_args.c index bb3992cbbc..1303243fd3 100644 --- a/vm_args.c +++ b/vm_args.c @@ -1177,7 +1177,8 @@ vm_caller_setup_fwd_args(const rb_execution_context_t *ec, rb_control_frame_t *r *adjusted_ci = VM_CI_ON_STACK( site_mid, - ((caller_flag & ~VM_CALL_ARGS_SIMPLE) | (site_flag & (VM_CALL_FCALL | VM_CALL_FORWARDING))), + ((caller_flag & ~(VM_CALL_ARGS_SIMPLE | VM_CALL_FCALL)) | + (site_flag & (VM_CALL_FCALL | VM_CALL_FORWARDING))), site_argc + caller_argc, kw );