From: "ufuk (Ufuk Kayserilioglu)" Date: 2022-01-11T01:18:41+00:00 Subject: [ruby-core:107034] [Ruby master Bug#18470] Union of two identical sets produces a set with duplicate members Issue #18470 has been updated by ufuk (Ufuk Kayserilioglu). Doesn't the following from https://bugs.ruby-lang.org/issues/16996 address this issue? > ... > Today, it is official that sets with elements that are later mutated must be `Set#reset`, so it is official that this should not be relied upon. > ... It seems like this is not a bug and the outcome is expected without a call to `Set#reset`: ```ruby C = Struct.new :id a = Set.new b = Set.new f = C.new a << f f.id = 1 b << f a.reset # => #}> a + b # => #}> b + a # => #}> ``` ---------------------------------------- Bug #18470: Union of two identical sets produces a set with duplicate members https://bugs.ruby-lang.org/issues/18470#change-95865 * Author: smokinggun (John Weir) * Status: Open * Priority: Normal * ruby -v: ruby 3.1.0p0 (2021-12-25 revision fb4df44d16) [x86_64-linux] * Backport: 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN ---------------------------------------- We came across an issue where the union of two identical sets produced a non uniq Set. We noticed this when upgrading from 2.7.1 to 3.1 See the attached test, the last assertion fails ``` ruby C = Struct.new :id a = Set.new b = Set.new f = C.new a << f f.id = 1 b << f a + b # => #, #}> b + a # => #}> (a + b).uniq => [#] ``` ---Files-------------------------------- set_test.rb (348 Bytes) -- https://bugs.ruby-lang.org/ Unsubscribe: