From f7aee584987e24768670e96b1455ed1193f91ef2 Mon Sep 17 00:00:00 2001 From: Yusuke Endoh Date: Fri, 20 Dec 2019 19:41:15 +0900 Subject: vm_args.c: rephrase the warning message of keyword argument separation (old) test.rb:4: warning: The last argument is used as the keyword parameter test.rb:1: warning: for `foo' defined here; maybe ** should be added to the call? (new) test.rb:4: warning: The last argument is used as keyword parameters; maybe ** should be added to the call test.rb:1: warning: The called method `foo' is defined here --- vm_args.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'vm_args.c') diff --git a/vm_args.c b/vm_args.c index 924af7157d..47ab8ee66a 100644 --- a/vm_args.c +++ b/vm_args.c @@ -658,11 +658,11 @@ rb_warn_keyword_to_last_hash(rb_execution_context_t * const ec, struct rb_callin rb_warn("The keyword argument is passed as the last hash parameter"); if (name) { rb_compile_warn(RSTRING_PTR(RARRAY_AREF(loc, 0)), FIX2INT(RARRAY_AREF(loc, 1)), - "for `%"PRIsVALUE"' defined here", name); + "The called method `%"PRIsVALUE"' is defined here", name); } else { rb_compile_warn(RSTRING_PTR(RARRAY_AREF(loc, 0)), FIX2INT(RARRAY_AREF(loc, 1)), - "for method defined here"); + "The called method is defined here"); } } } @@ -683,11 +683,11 @@ rb_warn_split_last_hash_to_keyword(rb_execution_context_t * const ec, struct rb_ rb_warn("The last argument is split into positional and keyword parameters"); if (calling->recv != Qundef) { rb_compile_warn(RSTRING_PTR(RARRAY_AREF(loc, 0)), FIX2INT(RARRAY_AREF(loc, 1)), - "for `%"PRIsVALUE"' defined here", name); + "The called method `%"PRIsVALUE"' is defined here", name); } else { rb_compile_warn(RSTRING_PTR(RARRAY_AREF(loc, 0)), FIX2INT(RARRAY_AREF(loc, 1)), - "for method defined here"); + "The called method is defined here"); } } } @@ -701,18 +701,18 @@ rb_warn_last_hash_to_keyword(rb_execution_context_t * const ec, struct rb_callin name = rb_id2str(ci->mid); loc = rb_iseq_location(iseq); if (NIL_P(loc)) { - rb_warn("The last argument for `%"PRIsVALUE"' is used as the keyword parameter; maybe ** should be added to the call?", + rb_warn("The last argument for `%"PRIsVALUE"' is used as keyword parameters; maybe ** should be added to the call", name); } else { - rb_warn("The last argument is used as the keyword parameter"); + rb_warn("The last argument is used as keyword parameters; maybe ** should be added to the call"); if (calling->recv != Qundef) { rb_compile_warn(RSTRING_PTR(RARRAY_AREF(loc, 0)), FIX2INT(RARRAY_AREF(loc, 1)), - "for `%"PRIsVALUE"' defined here; maybe ** should be added to the call?", name); + "The called method `%"PRIsVALUE"' is defined here", name); } else { rb_compile_warn(RSTRING_PTR(RARRAY_AREF(loc, 0)), FIX2INT(RARRAY_AREF(loc, 1)), - "for method defined here; maybe ** should be added to the call?"); + "The called method is defined here"); } } } -- cgit v1.2.3