From: "byroot (Jean Boussier)" Date: 2022-01-10T21:16:42+00:00 Subject: [ruby-core:107030] [Ruby master Bug#18470] Union of two identical sets produces a set with duplicate members Issue #18470 has been updated by byroot (Jean Boussier). So it's indeed a rehash issue: https://github.com/casperisfine/set/commit/40ff2f907118d8766217bbe8ac27119111050217 Also it seems @marcandre knew about this case (or similar), based on the description of the issue I linked. The main problem is that `Set` doesn't expose a `rehash` method, so there's not really any way to workaround it. Maybe it should? ---------------------------------------- Bug #18470: Union of two identical sets produces a set with duplicate members https://bugs.ruby-lang.org/issues/18470#change-95861 * 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: