Repository navigation
feat: enforce tail-resumptive effect handlers (#564) - #1349
Merged
Merged
Conversation
Keep algebraic-effect handlers as the conservative 1.0 model: a capability method is an ordinary call that returns to the operation site. Reject the reserved resume/resume_multi forms in handlers, document abort/retry as caller-side encodings, and record the deferred continuation decision. Co-authored-by: Abhishek Shivakumar <[email protected]>
flowc_stage_a.c now includes the #564 capability-method scan that rejects resume/resume_multi. Verified with bootstrap_from_c.sh --verify. Co-authored-by: Abhishek Shivakumar <[email protected]>
compiler/bootstrap: took main's, then bootstrap_from_c.sh --regen (fixed point at gen2 on macOS; Linux x86-64 ELF rebuilt on the box). Checked-in flowc_stage_a is Linux x86-64 like main's. docs/project/CHANGELOG.md: kept main's entries and this branch's. Also normalize em dashes in docs/language/cold-start.md and compiler/src/main.flow so the pre-commit prose check passes (those came from main).
Catch up after #1409. Only compiler/bootstrap/flowc_stage_a conflicted. Took main's bootstrap and re-ran bootstrap_from_c.sh --regen (fixed point at gen2; C unchanged vs prior tip). Checked-in flowc_stage_a is the Linux x86-64 ELF.
parity_mlir --record on this branch. Updates the drifted test_typecheck_overload_integration digest and records digests for new fixtures this branch accepts.
godofecht
added a commit
that referenced
this pull request
Oct 6, 2026
Resolve bootstrap binary by taking main then regenerating.
godofecht
added a commit
that referenced
this pull request
Oct 6, 2026
Resolve bootstrap binary by taking main then regenerating.
godofecht
added a commit
that referenced
this pull request
Oct 6, 2026
This was referenced Oct 7, 2026
godofecht
added a commit
that referenced
this pull request
Oct 7, 2026
…om closed PRs Salvaged from closed pull requests whose code already landed: - #1360 (region inference, code merged as #1390): region-inference.md, the tests/cgen region_inference and region_unproven goldens, and the spec, book, spans, lifetime-domains, README, spec-index, nav and CHANGELOG lines. - #1368 (noalias, code merged as #1388): the spans.md paragraph on restrict .data temporaries and its noalias.md link. - #1380 (tail-resumptive effects, code merged as #1349): the spec-index row for effects-continuations.md. #1417 landed after #1360 and keeps an unproven forward copy as an ordered element loop. The region_inference golden and the docs now say that, in place of the memmove the closed branch expected. The golden fails on the pre-#1417 compiler, which emitted memmove.
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.
Closes #564
Intent
Linked issue or roadmap item: #564 (algebraic effects are tail-resumptive only).
What changed, and why is this the smallest useful change?
This is a language-design question: abort, retry, and multi-shot need real continuation capture. The conservative 1.0 option is to keep tail-resumptive handlers, reject reserved
resume/resume_multiin capability methods, and document Result/status and caller-loop encodings. Recorded indocs/project/Questions.md. Options 2/3 (abort-only, or general continuations) stay open for a later human decision.Overlap check
Overlap / dependency notes: No open PR implements abort/retry/multi-shot or the tail-resumptive rule. The RFC already accepted the limitation as documentation; this makes it a compiler-enforced 1.0 rule. Previous docs-only sessions were not merged.
Evidence
Baseline before this change: host-built flowc from the previous bootstrap (
flowc: PASS).resume(x)in a capability method was an unbound/undefined call, not a dedicated diagnostic.Targeted proof that exercises the changed behaviour:
compiler/fixtures/effects/resume_in_handler.flowandresume_multi_in_handler.flow: rejects with the tail-resumptive diagnostic.compiler/fixtures/typecheck_rules/effect_resume.flow: same message../flow test-lang tests/lang/test_effects_tail_resumptive.flow: two resumes in one handle block, status-code "abort" still returns to the call site, retry is a caller loop.Why that proof would detect the old failure or regression: the reserved-form fixtures fail if the diagnostic is missing or the wording drifts. The language test fails if a handler return no longer resumes the call site or if a status-code "abort" skips the rest of the handle block.
Repository gate(s) run:
env -u FLOWC_IN -u FLOWC_OUT "$(./flow tool compiler/scripts/flowc_host.flow)"→flowc: PASS./compiler/scripts/bootstrap_from_c.sh --regenthen--verify→ALL PASS bootstrap_from_c./flow test-lang→ 267 passed, 0 failed./flow tool compiler/scripts/parity_effects.flow→ 17 fixtures passed./flow tool compiler/scripts/typecheck_rules.flow→ 126 passed, 0 failed./flow tool scripts/check_pkg_parity.flow→ 133 pass, 1 fail (install-git-bad-tagextra git warningCould not find remote branch v404 to clone). Unrelated to effects; no package-manager files changed.Generated/bootstrap state, if any:
compiler/bootstrap/flowc_stage_a.cregenerated to the fixed point in a separate commit.Risk
Compatibility, performance, security, lifetime, backend, or release implications:
New compile error only for
resume/resume_multiinside a capability method. No ABI or codegen change. The C backend remains a thread-local handler pointer plus a direct call.docs/project/Questions.mdupdated if this needs a language-design decision.Compatibility
docs/project/CHANGELOG.md.resume/resume_multiin a capability method become a type error.Agent handoff
Cloud agent implementing #564. Not merging. Remaining continuation work (abort-only or general capture) is recorded in
docs/project/Questions.md, not as an open gap of this PR.