feat(joinir): Phase 286 P3.2 - Pattern5 Plan line (loop(true) + early exit)
- Pattern5InfiniteEarlyExitPlan (Return/Break variants)
- extract_pattern5_plan() for loop(true) literal only
- normalize_pattern5_return(): 5 blocks CFG (header→body→found/step)
- normalize_pattern5_break(): 6 blocks CFG with carrier PHI
- NormalizationPlanBox exclusion for Pattern5-style loops
- Fixtures: phase286_pattern5_{return,break}_min.hako
- quick smoke 154/154 PASS
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
16
apps/tests/phase286_pattern5_break_min.hako
Normal file
16
apps/tests/phase286_pattern5_break_min.hako
Normal file
@ -0,0 +1,16 @@
|
||||
// Phase 286 P3.2: Pattern5 infinite loop with break
|
||||
// Tests: loop(true) with if (i == 3) { break } and carrier update
|
||||
// Expected: 3 (sum = 0 + 1 + 1 + 1 = 3 for i = 0, 1, 2)
|
||||
|
||||
static box Main {
|
||||
main() {
|
||||
local i = 0
|
||||
local sum = 0
|
||||
loop(true) {
|
||||
if (i == 3) { break }
|
||||
sum = sum + 1
|
||||
i = i + 1
|
||||
}
|
||||
return sum
|
||||
}
|
||||
}
|
||||
14
apps/tests/phase286_pattern5_return_min.hako
Normal file
14
apps/tests/phase286_pattern5_return_min.hako
Normal file
@ -0,0 +1,14 @@
|
||||
// Phase 286 P3.2: Pattern5 infinite loop with early return
|
||||
// Tests: loop(true) with if (i == 3) { return 7 }
|
||||
// Expected: 7
|
||||
|
||||
static box Main {
|
||||
main() {
|
||||
local i = 0
|
||||
loop(true) {
|
||||
if (i == 3) { return 7 }
|
||||
i = i + 1
|
||||
}
|
||||
return 0
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user