Description
Reproduction steps
Unfortunately, I couldn't minimize this bug, but I can point to some relevant commits:
On JD557/minart@5cf7dc8, running sbt +2.13.8 imageJVM/test
will fail, while sbt +3.1.1 imageJVM/test
will succeed. Simply reimplementing some operations to use next/hasNext fixed the problem.
Scala version: 2.13.8 and 3.1.1 (not sure which one has the "bug")
Problem
It appears that (sometimes) on 2.13.8 calling take(n).toArray
multiple times can return an empty array (similar to what happens on Vector.iterator
).
OTOH, on 3.1.1, calling take(n).toArray
multiple times seems to work as List.iterator
, and will just keep on iterating.
I understand that "calling take(n).toArray
multiple times" is undefined behavior, but since the stdlib is the same, I expected the code to have the same undefined behavior on both compiler versions