Skip to content

Commit 33dcf45

Browse files
author
Nicolas Laurent
committed
add contains check to flatten helper
1 parent 8d065f3 commit 33dcf45

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/main/ruby/truffleruby/core/truffle/array_operations.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ def self.flatten_helper(array, out, max_levels = -1)
2020
array, i = worklist.pop
2121

2222
if i == 0
23+
unless Primitive.object_can_contain_object array
24+
out.concat(array)
25+
next
26+
end
2327
raise ArgumentError, 'tried to flatten recursive array' if visited.key?(array)
2428
if max_levels == worklist.size
2529
out.concat(array)

0 commit comments

Comments
 (0)