New Issue: [Bug]: 'forall' loop expressions do not (always) use parallel iterators

28471, "DanilaFe", "[Bug]: 'forall' loop expressions do not (always) use parallel iterators", "2026-02-27T21:20:59Z"

The design of the forall loop is such that it requires a parallel iterator from its leader data structure. However, this is apparently not properly handled for forall loop expressions, which will happily iterate over a serial iter without complaint.

iter foo(): int {}
var tmp = forall p in foo() do p;
writeln(tmp);

Note that we presently do not allow parallel iterators to be used for materializing iterators into arrays (because we dynamically grow the destination array, which is hard to do in parallel), so this program ought to be invalid for two reasons:

  • forall should not allow the serial foo() as its iterand
  • if foo() were parallel, tmp could not be initialized from it.

However, we end up with a serial loop expression and a serially-initialized tmp, and no error.