Phase 286 P2: Pattern4 (Loop with Continue) を Plan/Frag SSOT に移行 - DomainPlan::Pattern4Continue 追加 - PlanNormalizer::normalize_pattern4_continue() 実装(phi_bindings による PHI dst 優先参照) - Router integration(Plan line routing → legacy fallback) - Integration test PASS (output: 6), quick smoke 154/154 PASS Phase 286 P2.1: Pattern1 (SimpleWhile) を Plan/Frag SSOT に移行 - DomainPlan::Pattern1SimpleWhile 追加 - PlanNormalizer::normalize_pattern1_simple_while() 実装(4ブロック、1 PHI、phi_bindings 流用) - Router integration(Plan line routing → legacy fallback) - Integration test PASS (return: 3), quick smoke 154/154 PASS Phase 286 P2.2: hygiene(extractor重複排除 + router小整理) - extractor helper化: extract_loop_increment_plan を common_helpers.rs に統一 - Pattern1/Pattern4 が呼ぶだけに変更(重複排除 ~25行) - router helper化: lower_via_plan() を追加し Pattern6/7/4/1 で共用 - 3行パターン(normalize→verify→lower)を1関数に集約(ボイラープレート削減 ~40行) 成果物: - DomainPlan 2パターン新規追加(Pattern1SimpleWhile, Pattern4Continue) - Normalizer 2つの normalize 関数追加 - Router に Plan line ブロック追加 + lower_via_plan() helper - Extractor に extract_pattern1_plan() 追加 - Integration fixtures 2個 + smoke tests 2個 検証: - quick smoke: 154/154 PASS - integration: phase286_pattern1_frag_poc PASS, phase286_pattern4_frag_poc PASS - Plan line routing: route=plan strategy=extract で Pattern1/4 検出確認 🤖 Generated with Claude Code Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
39 lines
1.1 KiB
Plaintext
39 lines
1.1 KiB
Plaintext
// Phase 286 P2: Pattern4 → Frag PoC minimal fixture
|
|
//
|
|
// Purpose: Test Pattern4 (Loop with Continue) using Plan/Frag SSOT
|
|
// Expected output: 6 (sum of 1+2+3, skipping i==0)
|
|
//
|
|
// Structure:
|
|
// i = 0, sum = 0 // pre-loop init
|
|
// loop(i < 4) { // loop variable condition
|
|
// if (i == 0) { i = i + 1; continue } // continue at i==0 (SINGLE continue)
|
|
// sum = sum + i // carrier update (accumulator pattern)
|
|
// i = i + 1 // loop increment
|
|
// }
|
|
// return sum // return 1+2+3=6
|
|
//
|
|
// PoC Goal:
|
|
// Pattern4 → DomainPlan → CorePlan → Frag → emit_frag()
|
|
// (Skip: JoinIR → bridge → merge)
|
|
//
|
|
// Design Note:
|
|
// - Uses only Compare (==, <) and Add (+) operators
|
|
// - Avoids Mod (%) which lacks Plan/Frag support guarantee
|
|
// - Single continue condition for Plan line PoC
|
|
// - Accumulator pattern for carrier (sum = sum + i)
|
|
|
|
static box Main {
|
|
main() {
|
|
local i, sum
|
|
i = 0
|
|
sum = 0
|
|
loop(i < 4) {
|
|
if (i == 0) { i = i + 1; continue }
|
|
sum = sum + i
|
|
i = i + 1
|
|
}
|
|
print(sum)
|
|
return 0
|
|
}
|
|
}
|