[#98645] [Ruby master Misc#16933] DevelopersMeeting20200618Japan — mame@...

Issue #16933 has been reported by mame (Yusuke Endoh).

14 messages 2020/06/04

[#98663] [Ruby master Bug#16936] `make check TESTS="-n !/Foo#method/"` not skipping the test case — jaruga@...

Issue #16936 has been reported by jaruga (Jun Aruga).

13 messages 2020/06/05

[#98772] [Ruby master Bug#16959] Weakmap has specs and third-party usage despite being a private API — headius@...

Issue #16959 has been reported by headius (Charles Nutter).

13 messages 2020/06/12

[#98826] [Ruby master Feature#16963] Remove English.rb from Ruby 2.8/3.0 — hsbt@...

Issue #16963 has been reported by hsbt (Hiroshi SHIBATA).

9 messages 2020/06/16

[#98920] [Ruby master Bug#16978] Ruby should not use realpath for __FILE__ — v.ondruch@...

Issue #16978 has been reported by vo.x (Vit Ondruch).

24 messages 2020/06/23

[#98947] [Ruby master Feature#16986] Anonymous Struct literal — ko1@...

Issue #16986 has been reported by ko1 (Koichi Sasada).

66 messages 2020/06/26

[#98964] [Ruby master Feature#16989] Sets: need ♥️ — marcandre-ruby-core@...

SXNzdWUgIzE2OTg5IGhhcyBiZWVuIHJlcG9ydGVkIGJ5IG1hcmNhbmRyZSAoTWFyYy1BbmRyZSBM

33 messages 2020/06/26

[#98965] [Ruby master Feature#16990] Sets: operators compatibility with Array — marcandre-ruby-core@...

Issue #16990 has been reported by marcandre (Marc-Andre Lafortune).

11 messages 2020/06/26

[#98968] [Ruby master Feature#16993] Sets: from hash keys using Hash#key_set — marcandre-ruby-core@...

Issue #16993 has been reported by marcandre (Marc-Andre Lafortune).

10 messages 2020/06/26

[#98997] [Ruby master Feature#17000] 2.7.2 turns off deprecation warnings by deafult — mame@...

Issue #17000 has been reported by mame (Yusuke Endoh).

16 messages 2020/06/30

[ruby-core:98732] [Ruby master Bug#16950] Stop nonsense keyword argument warnings in 2.6

From: mame@...
Date: 2020-06-11 07:14:09 UTC
List: ruby-core #98732
Issue #16950 has been reported by mame (Yusuke Endoh).

----------------------------------------
Bug #16950: Stop nonsense keyword argument warnings in 2.6
https://bugs.ruby-lang.org/issues/16950

* Author: mame (Yusuke Endoh)
* Status: Open
* Priority: Normal
* Assignee: usa (Usaku NAKAMURA)
* ruby -v: ruby 2.6.7p147 (2020-03-31 revision 67883) [x86_64-linux]
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN
----------------------------------------
Ruby 2.6 warns the following code with `-w` option:

```
def foo(x)    # warning: in `foo': the last argument was passed as a single Hash
end
h = { k: 42 }
foo(**h)      # warning: although a splat keyword arguments here
```

This warning had been introduced by @nobu based on the original proposal of [#14183 "Real" keyword argument](https://bugs.ruby-lang.org/issues/14183).  However, the design was changed so that automatic conversion from keywords to positional arguments will be kept in 3.0.  In other words, the code above will work even in 3.0, so the warning no longer makes sense.

Rather, according to @matsuda and @kamipo, this warning sometimes hindered the fix work for the keyword argument change in Rails.  This issue is possible to work around by using always non-keyword argument (and [they actually did so](https://github.com/rails/rails/commit/c0fd8f4bb2d4dd9abfbef9cc658ca0c88b8b0842)), but they say it is very annoying.

So, I propose stopping the warning in 2.6.  This is a change for 2.6, but matz already accepted this.  @usa, do you accept this?

A patch is quite simple:

```patch
diff --git a/vm_args.c b/vm_args.c
index 299ed16aa8..2e70ed3fcf 100644
--- a/vm_args.c
+++ b/vm_args.c
@@ -685,17 +685,6 @@ setup_parameters_complex(rb_execution_context_t * const ec, const rb_iseq_t * co
     else if (!NIL_P(keyword_hash) && RHASH_SIZE(keyword_hash) > 0) {
 	argument_kw_error(ec, iseq, "unknown", rb_hash_keys(keyword_hash));
     }
-    else if (kw_splat && NIL_P(keyword_hash)) {
-	if (RTEST(ruby_verbose)) {
-	    VALUE path = rb_iseq_path(iseq);
-	    VALUE line = rb_iseq_first_lineno(iseq);
-	    VALUE label = rb_iseq_label(iseq);
-	    rb_compile_warning(NIL_P(path) ? NULL : RSTRING_PTR(path), FIX2INT(line),
-			       "in `%s': the last argument was passed as a single Hash",
-			       NIL_P(label) ? NULL : RSTRING_PTR(label));
-	    rb_warning("although a splat keyword arguments here");
-	}
-    }
 
     if (iseq->body->param.flags.has_block) {
 	if (iseq->body->local_iseq == iseq) {
```



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread

Prev Next