Skip to content

eraiser: result = v projects onto the value half - #2568

Merged
Araq merged 1 commit into
masterfrom
araq-eraiser-passive-result
Sep 22, 2026
Merged

Araq merged 1 commit into
masterfrom
araq-eraiser-passive-result

Conversation

@Araq

@Araq Araq commented Sep 22, 2026

Copy link
Copy Markdown
Member

A raising routine's result = v was rebuilt as result = (Success, v). That nests v one level deep, and cps only ends a coroutine state where a suspension point is the ROOT of an assignment's value: a .passive call there was invisible, so result = passiveCall() in a raising coroutine returned 0, or failed with cps.nim: state != -1 in tail position.

The rebuild was redundant anyway: result[0] = Success is set at the declaration and every path that changes it leaves the routine, and a retyped local's check has already passed. So the assignment is simply result[1] = v, which the generic path already produces. trAsgn is gone.

A raising routine's `result = v` was rebuilt as `result = (Success, v)`.
That nests `v` one level deep, and `cps` only ends a coroutine state where
a suspension point is the ROOT of an assignment's value: a `.passive` call
there was invisible, so `result = passiveCall()` in a raising coroutine
returned 0, or failed with `cps.nim: state != -1` in tail position.

The rebuild was redundant anyway: `result[0] = Success` is set at the
declaration and every path that changes it leaves the routine, and a
retyped local's check has already passed. So the assignment is simply
`result[1] = v`, which the generic path already produces. `trAsgn` is gone.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@Araq
Araq merged commit 9922072 into master Sep 22, 2026
9 checks passed
@Araq
Araq deleted the araq-eraiser-passive-result branch September 22, 2026 09:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant