mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-02 07:45:49 +01:00
Building a `for` loop looks `Core.Iterate` up twice: once for `NewCursor` to make the cursor, and again for `Next` to advance it. A range that implements neither failed both lookups and reported both, so a loop over something that isn't iterable produced two errors saying the same thing about the same expression. The second lookup is skipped when the first already failed, which is what `BuildBinaryOperator`'s `diagnose` parameter is for. The `ErrorInst` it returns instead does not reach the produced SemIR: the loop is abandoned on the error either way. Assisted-by: Claude Code --------- Co-authored-by: josh11b <15258583+josh11b@users.noreply.github.com> Co-authored-by: Richard Smith <richard@metafoo.co.uk>