feat(res-to-affine): #488 partial-port slice 2 — pipe desugaring + if/else + blocks (Refs #488)#495
Merged
Merged
Conversation
…/else + blocks (Refs #488) Extends --partial: - pipe-first `->`: `a->f(b)` -> `f(a, b)`, `a->f` -> `f(a)`; chains desugar left-to-right through the recursion (`x->f->g(2)` -> `g(f(x), 2)`). - `if`/`else` expressions -> AffineScript `if c { .. } else { .. }`. - blocks with `let` statements -> `{ let y = ..; y * 2 }`; a block function body fills the `fn { .. }` directly (no double braces). walker: translate_pipe / translate_if / translate_as_block / translate_block(_inner) / translate_block_let added to the expr rec group; partial_function unwraps a block body. Array / record / object literals etc. still become `() /* TODO */` holes. Verified locally (apt-bootstrapped toolchain): full dune build exit 0; 30 res-to-affine walker tests green (3 new, against pinned grammar 990214a); `main.exe check` on the generated skeletons parses (resolution/type errors only, no parse error). Refs #488 https://claude.ai/code/session_017T8SzHr2yXav8hm4Ho76Uw
🔍 Hypatia Security ScanFindings: 83 issues detected
View findings[
{
"reason": "Action perpolymath/standards/.github/workflows/governance-reusable.yml@main\n needs attention",
"type": "unpinned_action",
"file": "governance.yml",
"action": "pin_sha",
"rule_module": "workflow_audit",
"severity": "medium"
},
{
"reason": "Action ons/checkout@v6\n needs attention",
"type": "unpinned_action",
"file": "publish-jsr.yml",
"action": "pin_sha",
"rule_module": "workflow_audit",
"severity": "medium"
},
{
"reason": "Action land/setup-deno@v2\n needs attention",
"type": "unpinned_action",
"file": "publish-jsr.yml",
"action": "pin_sha",
"rule_module": "workflow_audit",
"severity": "medium"
},
{
"reason": "Issue in affine-vscode-publish.yml",
"type": "missing_timeout_minutes",
"file": "affine-vscode-publish.yml",
"action": "flag",
"rule_module": "workflow_audit",
"severity": "medium"
},
{
"reason": "Issue in casket-pages.yml",
"type": "missing_timeout_minutes",
"file": "casket-pages.yml",
"action": "flag",
"rule_module": "workflow_audit",
"severity": "medium"
},
{
"reason": "Issue in casket-pages.yml",
"type": "missing_timeout_minutes",
"file": "casket-pages.yml",
"action": "flag",
"rule_module": "workflow_audit",
"severity": "medium"
},
{
"reason": "Issue in ci.yml",
"type": "missing_timeout_minutes",
"file": "ci.yml",
"action": "flag",
"rule_module": "workflow_audit",
"severity": "medium"
},
{
"reason": "Issue in ci.yml",
"type": "missing_timeout_minutes",
"file": "ci.yml",
"action": "flag",
"rule_module": "workflow_audit",
"severity": "medium"
},
{
"reason": "Issue in ci.yml",
"type": "missing_timeout_minutes",
"file": "ci.yml",
"action": "flag",
"rule_module": "workflow_audit",
"severity": "medium"
},
{
"reason": "Issue in ci.yml",
"type": "missing_timeout_minutes",
"file": "ci.yml",
"action": "flag",
"rule_module": "workflow_audit",
"severity": "medium"
}
]Powered by Hypatia Neurosymbolic CI/CD Intelligence |
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.
What
Slice 2 of #488 partial-port mode. Extends
--partial(built on slice 1, #494) with the three highest-value gaps:--partial)let piped = x => x->doStuff(1)fn piped(x: _) -> _ { doStuff(x, 1) }let chain = x => x->f->g(2)fn chain(x: _) -> _ { g(f(x), 2) }let clamp = x => if x > 0 { x } else { 0 }fn clamp(x: _) -> _ { if x > 0 { x } else { 0 } }let scaled = x => { let y = x + 1; y * 2 }fn scaled(x: _) -> _ { let y = x + 1; y * 2 }->desugars:a->f(b)→f(a, b),a->f→f(a). Chains desugar left-to-right for free through the recursion (x->f->g(2)→g(f(x), 2)) — ReScript parses pipes left-nested.if/else→ AffineScriptif c { … } else { … }.letstatements →{ let y = …; y * 2 }; a block function body fills thefn { … }directly (no double braces).walker:translate_pipe/translate_if/translate_as_block/translate_block(_inner)/translate_block_letadded to the expression rec group;partial_functionunwraps a block body. Array / record / object literals etc. still become() /* TODO */holes.Verification (local, apt-bootstrapped toolchain)
dune builddune runtest tools/res-to-affine/990214amain.exe checkon the skeletonNext under #488
record/array/object literals, labelled args, combining
--partialwith--translate, and module-qualified-reference resolution.Refs #488https://claude.ai/code/session_017T8SzHr2yXav8hm4Ho76Uw
Generated by Claude Code