1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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]
This commit is contained in:
Jeremy Evans 2019-06-04 19:08:54 -07:00
parent 2d076dd5ac
commit 258843106f

View file

@ -804,7 +804,8 @@ class SortedSet < Set
def initialize(*args, &block) # :nodoc:
SortedSet.setup
initialize(*args, &block)
@keys = nil
super
end
end