Files
hakorune/tools
tomoaki 275fe45ba4 feat(normalization): Phase 142 P0 - Statement-level normalization
## Summary

Changed normalization unit from "block suffix" to "statement (loop only)"
to prevent pattern explosion.

## Changes

1. **PlanBox** (`plan_box.rs`):
   - Always return `loop_only()` for any `loop(true)`, regardless of what follows
   - Subsequent statements (return, assignments) handled by normal MIR lowering
   - ~70 lines reduced, 7 unit tests updated

2. **build_block** (`stmts.rs`):
   - Removed `break` after consumed=1 from suffix_router
   - Continue processing subsequent statements normally
   - Phase 142 P0 comments added

3. **Tests**:
   - Fixture: `phase142_loop_stmt_only_then_return_length_min.hako`
   - VM smoke: exit code 3 (s="abc" → s.length() → 3)

## Results

-  Unit tests: 10/10 passed
-  Phase 142 VM smoke: PASS
-  Phase 131 regression: PASS
-  Build: Success

## Design

- **Pattern Explosion Prevention**: Normalize only the loop (consumed=1)
- **Out-of-Scope Policy**: Always Ok(None) for fallback
- **Fail-Fast**: Only for "in-scope but broken" cases

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-19 04:41:01 +09:00
..