Actions
Bug #12437
closedIs it "legal" to call collect! in class initializer?
Description
Is there any reason the following script should not work?
#! /usr/bin/ruby
require 'set'
class Categories < Set
def initialize(categories=[])
categories.collect! { |category| category } if categories
super categories
end
end
categories = Categories.new()
categories += [1, 2, 3]
p categories
categories2 = Categories.new(categories)
p categories2
It fails with stack level too deep (SystemStackError)
error and this regression seems to be introduced by r52591.
For details, please take a look at original issue reported here: https://bugzilla.redhat.com/show_bug.cgi?id=1308057
Files
Actions
Like0
Like0Like0Like0Like0