You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
test(borrow): #225 PR3b — affine-capture obligation discharged by composition (#237)
ADR-013 obligation 1 (a linear/owned local captured into the
continuation env is consumed exactly once; double-resumption
impossible) requires NO transform-aware static machinery. It is
discharged by composition:
(a) the borrow checker runs on the straight-line AST BEFORE the
codegen CPS transform (verified pipeline order, bin/main.ml), so
a double consume of an owned local across the async let is
rejected there exactly as in any synchronous body; and
(b) the PR2 once-resumption trap guarantees the continuation runs at
most once, so the transformed code performs each consume the
same number of times the checker already verified.
This commit pins (a) with two regressions in test_effects.ml
(frontend_borrow = parse->resolve->typecheck->Borrow.check_program):
- owned local captured across the async split + consumed TWICE ⇒
use-after-move, rejected by the existing checker (no new rule);
- the same capture shape consumed ONCE ⇒ accepted (the rule is not
over-rejecting the captured-once case the transform relies on).
The rationale is documented in-code (test_effects.ml block comment;
the codegen recogniser docstring already states it from PR3a). No
compiler/codegen change. dune test --force 260 (was 258, +2);
tools/run_codegen_wasm_tests.sh green (unaffected, confirmed). Refs
#225#160
0 commit comments