Project

General

Profile

Actions

Bug #10315

closed

Override policy for duplicated keywords

Added by ko1 (Koichi Sasada) over 7 years ago. Updated over 7 years ago.

Status:
Closed
Priority:
Normal
Target version:
ruby -v:
2.2-2.0
[ruby-core:65368]

Description

p({k1: 'a', k1: 'b'})         #=> {:k1=>"b"}
p({k1: 'a'}.merge({k1: 'b'})) #=> {:k1=>"b"}
p(k1: 'a', k1: 'b')           #=> {:k1=>"b"}
p(k1: 'a', **{k1: 'b'})       #=> {:k1=>"a"}

IMO the last case should also output {:k1=>"b"}.

Nobu said that we should show warning for such duplication (especially for 1st and 3rd cases) because we can detect duplication while parsing/compiling.


Related issues

Related to Ruby master - Bug #11501: About priority of a hash element when using {**hash1, **hash2} literalClosednagachika (Tomoyuki Chikanaga)Actions
Actions

Also available in: Atom PDF