diff options
Diffstat (limited to 'vm_args.c')
-rw-r--r-- | vm_args.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -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); |