Primitive.mandatory_only?
consider splat args
`vm_ci_argc` gives the number of arguments, but `*[1, 2, 3]` only counts for one.
This commit is contained in:
parent
5b6a397f3e
commit
1af8ed5f0a
Notes:
git
2021-11-17 06:38:24 +09:00
@ -241,6 +241,10 @@ class TestTime < Test::Unit::TestCase
|
|||||||
assert_equal(1, Time.at(0, 0.001).nsec)
|
assert_equal(1, Time.at(0, 0.001).nsec)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_at_splat
|
||||||
|
assert_equal(Time.at(1, 2), Time.at(*[1, 2]))
|
||||||
|
end
|
||||||
|
|
||||||
def test_at_with_unit
|
def test_at_with_unit
|
||||||
assert_equal(123456789, Time.at(0, 123456789, :nanosecond).nsec)
|
assert_equal(123456789, Time.at(0, 123456789, :nanosecond).nsec)
|
||||||
assert_equal(123456789, Time.at(0, 123456789, :nsec).nsec)
|
assert_equal(123456789, Time.at(0, 123456789, :nsec).nsec)
|
||||||
|
@ -1848,8 +1848,10 @@ vm_search_cc(const VALUE klass, const struct rb_callinfo * const ci)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((cme->def->iseq_overload &&
|
if (cme->def->iseq_overload &&
|
||||||
(int)vm_ci_argc(ci) == method_entry_iseqptr(cme)->body->param.lead_num)) {
|
(vm_ci_flag(ci) & (VM_CALL_ARGS_SIMPLE)) &&
|
||||||
|
(int)vm_ci_argc(ci) == method_entry_iseqptr(cme)->body->param.lead_num
|
||||||
|
) {
|
||||||
// use alternative
|
// use alternative
|
||||||
cme = overloaded_cme(cme);
|
cme = overloaded_cme(cme);
|
||||||
METHOD_ENTRY_CACHED_SET((struct rb_callable_method_entry_struct *)cme);
|
METHOD_ENTRY_CACHED_SET((struct rb_callable_method_entry_struct *)cme);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user