eraiser: result = v projects onto the value half - #2568
Merged
Merged
Conversation
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>
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.
A raising routine's
result = vwas rebuilt asresult = (Success, v). That nestsvone level deep, andcpsonly ends a coroutine state where a suspension point is the ROOT of an assignment's value: a.passivecall there was invisible, soresult = passiveCall()in a raising coroutine returned 0, or failed withcps.nim: state != -1in tail position.The rebuild was redundant anyway:
result[0] = Successis 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 simplyresult[1] = v, which the generic path already produces.trAsgnis gone.