ruby-changes:59052
From: Yusuke <ko1@a...>
Date: Tue, 3 Dec 2019 17:57:45 +0900 (JST)
Subject: [ruby-changes:59052] a1f98cd4c1 (master): vm_args.c: make the keyword deprecation message helpful
https://git.ruby-lang.org/ruby.git/commit/?id=a1f98cd4c1 From a1f98cd4c1d55efe4998ecd3d94508634baefc23 Mon Sep 17 00:00:00 2001 From: Yusuke Endoh <mame@r...> Date: Tue, 3 Dec 2019 17:56:50 +0900 Subject: vm_args.c: make the keyword deprecation message helpful ``` $ ./miniruby -e 'def foo(kw: 1); end; h = {kw: 1}; foo(h)' -e:1: warning: The last argument is used as the keyword parameter -e:1: warning: for `foo' defined here; maybe ** should be added to the call? ``` diff --git a/vm_args.c b/vm_args.c index c46b3cf..97b1d4a 100644 --- a/vm_args.c +++ b/vm_args.c @@ -693,18 +693,18 @@ rb_warn_last_hash_to_keyword(rb_execution_context_t * const ec, struct rb_callin https://github.com/ruby/ruby/blob/trunk/vm_args.c#L693 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", + rb_warn("The last argument for `%"PRIsVALUE"' is used as the keyword parameter; maybe ** should be added to the call?", name); } else { rb_warn("The last argument is used as the keyword parameter"); if (calling->recv != Qundef) { rb_compile_warn(RSTRING_PTR(RARRAY_AREF(loc, 0)), FIX2INT(RARRAY_AREF(loc, 1)), - "for `%"PRIsVALUE"' defined here", name); + "for `%"PRIsVALUE"' defined here; maybe ** should be added to the call?", name); } else { rb_compile_warn(RSTRING_PTR(RARRAY_AREF(loc, 0)), FIX2INT(RARRAY_AREF(loc, 1)), - "for method defined here"); + "for method defined here; maybe ** should be added to the call?"); } } } -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/