summaryrefslogtreecommitdiff
path: root/vm_args.c
diff options
context:
space:
mode:
Diffstat (limited to 'vm_args.c')
-rw-r--r--vm_args.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/vm_args.c b/vm_args.c
index 898301ce49..b505292e68 100644
--- a/vm_args.c
+++ b/vm_args.c
@@ -615,7 +615,8 @@ setup_parameters_complex(rb_thread_t * const th, const rb_iseq_t * const iseq,
}
if (given_argc > min_argc &&
- (iseq->body->param.flags.has_kw || iseq->body->param.flags.has_kwrest) &&
+ (iseq->body->param.flags.has_kw || iseq->body->param.flags.has_kwrest ||
+ (!iseq->body->param.flags.has_rest && (ci->flag & VM_CALL_KW_SPLAT))) &&
args->kw_argv == NULL) {
if (args_pop_keyword_hash(args, &keyword_hash, th)) {
given_argc--;
@@ -676,6 +677,9 @@ setup_parameters_complex(rb_thread_t * const th, const rb_iseq_t * const iseq,
else if (iseq->body->param.flags.has_kwrest) {
args_setup_kw_rest_parameter(keyword_hash, locals + iseq->body->param.keyword->rest_start);
}
+ else if (!NIL_P(keyword_hash) && RHASH_SIZE(keyword_hash) > 0) {
+ argument_kw_error(th, iseq, "unknown", rb_hash_keys(keyword_hash));
+ }
if (iseq->body->param.flags.has_block) {
args_setup_block_parameter(th, calling, locals + iseq->body->param.block_start);