Skip to content

[Bug] break does not exit reverse Foreach loops in List/Map/Str/Graph/BitVec #45

Description

@brightprogrammer

Vec's reverse Foreach macros wrapped the iteration loop in two run-once
for-loops (to inject the var/run_once declarations), so a break in the body
exited those wrappers rather than the iteration loop -- iteration silently
continued to the next element, while the forward variants stopped. Fixed for
Vec in commit 1179837 (iteration loop made innermost, mirroring the forward
variants; shrink-during-iteration guard preserved; forward + reverse
early-break tests added).

The same run-once-wrapper shape almost certainly exists in the reverse Foreach
macros of List, Map, Str, Graph, and BitVec, so break is likely swallowed
there too. Sweep each, apply the same fix, and add a reverse early-break test
per container.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions