[#65451] [ruby-trunk - Feature #10333] [PATCH 3/1] optimize: "yoda literal" == string — ko1@...

Issue #10333 has been updated by Koichi Sasada.

9 messages 2014/10/07

[ruby-core:65368] [ruby-trunk - Bug #10315] [Open] Override policy for duplicated keywords

From: ko1@...
Date: 2014-10-02 06:22:29 UTC
List: ruby-core #65368
Issue #10315 has been reported by Koichi Sasada.

----------------------------------------
Bug #10315: Override policy for duplicated keywords
https://bugs.ruby-lang.org/issues/10315

* Author: Koichi Sasada
* Status: Open
* Priority: Normal
* Assignee: Yukihiro Matsumoto
* Category: core
* Target version: current: 2.2.0
* ruby -v: 2.2-2.0
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN
----------------------------------------

```ruby
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.




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

In This Thread

Prev Next