Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Won't Fix
-
Affects Version/s: JRuby 1.4.0RC1
-
Fix Version/s: None
-
Component/s: Interpreter
-
Labels:None
-
Number of attachments :
Description
Not quite reduced test case, but the problem is
is ending up as [2] versus [[2]] (where 2 may not be 2 depending on which test case you are looking at below). Interestingly Ruby 1.9 behaves the same as us so it is debatable whether we need to fix this at all:
class X
def to_ary
[1, 2, 3]
end
end
x = X.new
puts "a, (*b) = 1, [2]"
a, (*b) = 1, [2]
p a == 1
p b == [[2]]
p b
puts "a, (*b) = 1, [x]"
a, (*b) = 1, [x]
p a == 1
p b == [[x]]
puts "a, (*b) = 1, [*x]"
a, (*b) = 1, [*x]
p a == 1
p b == [[1, 2, 3]]
puts "a, (*b) = 1, [*2]"
a, (*b) = 1, [*2]
p a == 1
p b == [[2]]
As Charlie suggested and it is a reasonable suggestion....These seem like bugs in 1.8.7 since the double array really does not seem like it is what you want?