[ruby-core:75093] [Ruby trunk Bug#12291] Struct member accessor is not consistent with hash access when keys are repeated

From: usa@...
Date: 2016-04-22 06:59:06 UTC
List: ruby-core #75093
Issue #12291 has been updated by Usaku NAKAMURA.

Backport changed from 2.1: REQUIRED, 2.2: REQUIRED, 2.3: DONE to 2.1: REQUIRED, 2.2: DONE, 2.3: DONE

ruby_2_2 r54685 merged revision(s) 54611,54612.

----------------------------------------
Bug #12291: Struct member accessor is not consistent with hash access when keys are repeated
https://bugs.ruby-lang.org/issues/12291#change-58218

* Author: James Coleman
* Status: Closed
* Priority: Normal
* Assignee: 
* ruby -v: ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin15]
* Backport: 2.1: REQUIRED, 2.2: DONE, 2.3: DONE
----------------------------------------
~~~
irb(main):001:0> foo = Struct.new(:a, :a).new("1", "2")
=> #<struct a="1", a="2">
irb(main):002:0> foo.a
=> "2"
irb(main):003:0> foo['a']
=> "1"
irb(main):004:0> foo.members
=> [:a, :a]
irb(main):005:0> foo.to_h
=> {:a=>"2"}
~~~



-- 
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