Issue #11501 has been reported by Satoshi SUZUKI.

----------------------------------------
Bug #11501: About priority of a hash element when using {**hash1, **hash2} literal
https://bugs.ruby-lang.org/issues/11501

* Author: Satoshi SUZUKI
* Status: Open
* Priority: Normal
* Assignee: 
* ruby -v: ruby 2.1.3p242 (2014-09-19 revision 47630) [x86_64-darwin13.0]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN
----------------------------------------
When creating a new hash with using { **hash1, **hash2 } literal,
there is difference behavior between 2.2.0 or later and 2.1.7 or earlier like below.

* ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-darwin13]
* ruby 2.1.3p242 (2014-09-19 revision 47630) [x86_64-darwin13.0]

~~~
[1] pry(main)> hash1 = { duplicate_key: 1, key: 1 }
=> {:duplicate_key=>1, :key=>1}
[2] pry(main)> hash2 = { duplicate_key: 3 }
=> {:duplicate_key=>3}
[3] pry(main)> { **hash1, **hash2 }
=> {:duplicate_key=>3, :key=>1}
[4] pry(main)>
~~~

* ruby 2.1.7p400 (2015-08-18 revision 51632) [x86_64-darwin13.0]

~~~
[1] pry(main)> hash1 = { duplicate_key: 1, key: 1 }
=> {:duplicate_key=>1, :key=>1}
[2] pry(main)> hash2 = { duplicate_key: 3 }
=> {:duplicate_key=>3}
[3] pry(main)> { **hash1, **hash2 }
=> {:duplicate_key=>1, :key=>1}
[4] pry(main)>
~~~

It seems that the behavior has changed since 2.2.0, however there is no mentions in any documents as far as I searched.

> * https://github.com/ruby/ruby/blob/v2_2_0/NEWS
> * https://www.ruby-lang.org/en/news/2014/12/25/ruby-2-2-0-released/

Is this intended change?
Please check this and give me a opinion.
Warm Regards.



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