From 258843106f343d05732499dd1832958eb1bf64f0 Mon Sep 17 00:00:00 2001 From: Jeremy Evans Date: Tue, 4 Jun 2019 19:08:54 -0700 Subject: Fix SortedSet subclasses that override initialize The first time SortedSet#initialize is called, it overwrites itself, then recalls #initialize, which results in calling the subclass's initialize, not the current initialize. Just inline the default initialize behavior to avoid this issue. No test for this as it can only be triggered the very first time that SortedSet#initialize is called. Fixes [Bug #15830] --- lib/set.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/set.rb b/lib/set.rb index 921f18f97b..a0e945e0a8 100644 --- a/lib/set.rb +++ b/lib/set.rb @@ -804,7 +804,8 @@ class SortedSet < Set def initialize(*args, &block) # :nodoc: SortedSet.setup - initialize(*args, &block) + @keys = nil + super end end -- cgit v1.2.3