Repository navigation
D185 (#2960): the bracket comprehension over Option and Result yields the carrier; the yield expression form is retired (§13.6a) - #2990
Merged
Conversation
ehartford
force-pushed
the
d185-comprehensions
branch
from
November 2, 2026 22:20
4dc9fab to
c7ddcd7
Compare
Contributor
Author
|
Battery green on c7ddcd7 ( |
ehartford
marked this pull request as ready for review
November 2, 2026 22:35
…and Result yields the carrier of the element (§13.6, §13.6a) A bracket comprehension whose first clause iterates an Option or a Result is the short-circuiting chain: the parser builds the clause match beside it (build_comprehension_match, with each clause's guard as a guard clause) as it does for a `for`, Sema checks the first iterable once and, seeing a carrier, checks that match and types the expression as the carrier of the element, never a List of one; MIR lowers it as the match. A guard may now follow any clause of a bracket comprehension (the collection form already lowered per-clause filters). The `for x in a; y in b: yield e` expression form and the one-clause `for x in opt: yield e` are retired (Law 9), each refused naming the bracket form; the statement form stays. Fixtures: behav_d185_bracket_option_guard; the four fixtures that used the yield form now spell the bracket form; err_d185_yield_form_retired, err_d185_one_clause_yield_retired. Conformance row D185 flips.
ehartford
force-pushed
the
d185-comprehensions
branch
from
November 2, 2026 22:41
c7ddcd7 to
03f0b14
Compare
Contributor
Author
|
Battery green again on 03f0b14, rebased onto main after D183 and D191 (the only conflict was an inventory row). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Item 2 of bridge-the-impl-gap.md, ruled by Eric 2026-11-02 (D185). The parser builds the clause match beside a bracket comprehension; Sema takes it when the first clause is an Option or Result and types the result as the carrier of the element; MIR lowers it as the match. Guards may follow any clause. The
yieldexpression forms are refused naming the bracket form; the statement form stays. Fixtures updated and added; conformance row D185 flips. Battery to follow.