diff options
author | Jean Boussier <jean.boussier@gmail.com> | 2021-11-16 11:33:39 +0100 |
---|---|---|
committer | Koichi Sasada <ko1@atdot.net> | 2021-11-17 06:38:03 +0900 |
commit | 1af8ed5f0a2c381c5dee4a5bcffff61f270c30d9 (patch) | |
tree | cd3e1ccfee9d0405e5b5a5ad3cf216102cfaa7c5 /vm_insnhelper.c | |
parent | 5b6a397f3e73e58d585c01ac2e3908cfac873c8c (diff) |
`Primitive.mandatory_only?` consider splat args
`vm_ci_argc` gives the number of arguments, but `*[1, 2, 3]` only
counts for one.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/5124
Diffstat (limited to 'vm_insnhelper.c')
-rw-r--r-- | vm_insnhelper.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/vm_insnhelper.c b/vm_insnhelper.c index 8e0793e070..9974a8a4f8 100644 --- a/vm_insnhelper.c +++ b/vm_insnhelper.c @@ -1848,8 +1848,10 @@ vm_search_cc(const VALUE klass, const struct rb_callinfo * const ci) } } - if ((cme->def->iseq_overload && - (int)vm_ci_argc(ci) == method_entry_iseqptr(cme)->body->param.lead_num)) { + if (cme->def->iseq_overload && + (vm_ci_flag(ci) & (VM_CALL_ARGS_SIMPLE)) && + (int)vm_ci_argc(ci) == method_entry_iseqptr(cme)->body->param.lead_num + ) { // use alternative cme = overloaded_cme(cme); METHOD_ENTRY_CACHED_SET((struct rb_callable_method_entry_struct *)cme); |