Merge: Fix bug with reverse iterators in arrays
Using `Array::iterator` after a finished `reverse_iterator` iterates only on the first element, or crash if array is empty. As `ReverseArrayIterator` specialize `ArrayIterator`, it can cache itself in the array to be used by `iterator`.
This PR simply disable caching for reverse iterators. We could add a distinct cache for the reverse iterator if we need the performance.
This minimal program highlights the bug:
~~~nit
var a = [1, 2, 3]
for x in a.reverse_iterator do print x
print "-"
for x in a.iterator do print x
~~~
Output:
~~~
3
2
1
-
1
~~~
Pull-Request: #1569
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>