The added test case was emitting a wrong/confusing error message, because a for loop only gets type-checked in its desugared form, as a while loop.
The error message was A while loop's loop body cannot implicitly return a value. Try assigning it to a mutable variable declared outside of the loop instead.
Corrected to: A for loop's loop body cannot implicitly return a value. Try assigning it to a mutable variable declared outside of the loop instead.
Fixes #6395
Description
Checklist
[ ] I have linked to any relevant issues.
[ ] I have commented my code, particularly in hard-to-understand areas.
[ ] I have updated the documentation where relevant (API docs, the reference, and the Sway book).
The added test case was emitting a wrong/confusing error message, because a for loop only gets type-checked in its desugared form, as a while loop.
The error message was
A while loop's loop body cannot implicitly return a value. Try assigning it to a mutable variable declared outside of the loop instead.
Corrected to:
A for loop's loop body cannot implicitly return a value. Try assigning it to a mutable variable declared outside of the loop instead.
Fixes #6395
Description
Checklist
Breaking*
orNew Feature
labels where relevant.