Project

General

Profile

Actions

Bug #7768

closed

Inherited Array class missing

Added by england (Roman Ivanilov) about 11 years ago. Updated over 4 years ago.

Status:
Closed
Target version:
-
ruby -v:
1.9
Backport:
[ruby-core:51792]

Description

Hello. I apologize if I missed something.
I found strange behavior in ruby 1.9:

 class Custom < Array; end
 Custom.new(0){|i| i + 1}.uniq.class # => Array
 Custom.new(2){|i| i + 1}.uniq.class # => Custom

while in 1.8 it works just as I expected.

 class Custom < Array; end
 Custom.new(0){|i| i + 1}.uniq.class # => Custom
 Custom.new(2){|i| i + 1}.uniq.class # => Custom
  • it is actual not only for the uniq method.
  • tested with ree-1.8.7-2010.02, ruby-1.9.2-p290, ruby-1.9.3-p375, ruby-1.9.3-p125

Any bug here?


Files

array-uniq-subclass-instance.patch (2.15 KB) array-uniq-subclass-instance.patch jeremyevans0 (Jeremy Evans), 07/15/2019 09:07 PM

Related issues 2 (0 open2 closed)

Related to Ruby master - Bug #7625: Arrayを継承したオブジェクトのcompactがArrayを返すClosedmatz (Yukihiro Matsumoto)12/26/2012Actions
Related to Ruby master - Bug #4136: Enumerable#reject should not inherit the receiver's instance variablesClosed12/09/2010Actions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0