summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Evans <code@jeremyevans.net>2019-06-04 19:08:54 -0700
committerJeremy Evans <code@jeremyevans.net>2019-09-06 14:20:22 -0700
commit258843106f343d05732499dd1832958eb1bf64f0 (patch)
tree4ae475029914be00a7dceae93ca57fec753071b2
parent2d076dd5ac8fc1102939f04236878446348599d0 (diff)
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]
-rw-r--r--lib/set.rb3
1 files changed, 2 insertions, 1 deletions
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