spec: for-range iterator yield function requires bool result - consider generalizing to any boolean type #71164
Labels
early-in-cycle
A change that should be done early in the 3 month dev cycle.
LanguageChange
Suggested changes to the Go language
NeedsDecision
Feedback is required from experts, contributors, and/or the community before a change can be made.
Milestone
Per the spec, a "for-range" statement using an iterator requires the iterator's
yield
function to returnbool
not an arbitrary (user-defined) boolean:We should generalize this to any boolean type, similarly to how we allow any string type (not just
string
) when we range of strings.Note that the original implementation of the type-checker accepted any boolean type, but the compiler's front-end had a problem with it (#71131). The (temporary) fix for that issue was to adjust the type-checker to match the spec literally. This avoided a compiler panic.
We should change the spec to reflect the original intent, and then revert the fix for #71131.
The text was updated successfully, but these errors were encountered: