[ruby-core:71001] [Ruby trunk - Feature #11568] [Closed] Misleading warning for duplicate keys in a hash

From: nobu@...
Date: 2015-10-06 04:41:42 UTC
List: ruby-core #71001
Issue #11568 has been updated by Nobuyoshi Nakada.

Description updated
Status changed from Open to Closed

----------------------------------------
Feature #11568: Misleading warning for duplicate keys in a hash
https://bugs.ruby-lang.org/issues/11568#change-54374

* Author: Tsuyoshi Sawada
* Status: Closed
* Priority: Normal
* Assignee: 
----------------------------------------
When a hash literal has duplicate keys as follows,

~~~ruby
{
  a: "foo",
  a: "bar",
}

~~~

the warning message goes as follows:

~~~
warning: duplicated key at line 3 ignored: :a
~~~

This message gives the impression as if it is the value `"bar"` at line 3 that is ignored, even though in reality it is the value `"foo"` at line 2 that is ignored. It is misleading. I suggest the message to be changed.



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

In This Thread

Prev Next