phase29ab(p1): pattern2 carrier binding policy + loopbodylocal fixture

This commit is contained in:
2025-12-28 07:19:03 +09:00
parent 61a3384bd2
commit 3bd0c817be
6 changed files with 139 additions and 14 deletions

View File

@ -0,0 +1,29 @@
# Pattern2 (Loop with Break) - JoinIR
## Scope / Criteria
- `loop(...) { ... break ... }` (break present, no continue/return)
- break condition is normalized to "break when <cond> is true"
- loop variable comes from header condition or loop(true) counter extraction
## LoopBodyLocal promotion
- SSOT entry: `pattern2::api::try_promote`
- Supported: A-3 Trim / A-4 DigitPos (promote LoopBodyLocal to carrier)
- ConditionOnly carriers are recalculated per iteration (no host binding)
## Carrier binding rules (Pattern2)
- `CarrierInit::FromHost` -> host binding required
- `CarrierInit::BoolConst(_)` / `CarrierInit::LoopLocalZero` -> host binding is skipped
- ConditionOnly carriers must not use `FromHost`
## Out of scope
- multiple breaks / continue / return in the loop body
- reassigned LoopBodyLocal or ReadOnlySlot contract violations
- break conditions with unsupported AST shapes
## Fail-Fast policy
- `PromoteDecision::Freeze` -> Err (missing implementation or contract violation)
- JoinIR lowering/merge contract violations -> Err
## `Ok(None)` meaning
- not Pattern2 (extractor returns None)
- promotion NotApplicable (router fallback)