refactor(normalization): Deprecate LoopWithPost variant

- Mark LoopWithPost enum variant as deprecated (Phase 142 P0)
- Add deprecation to loop_with_post() constructor function
- Document migration path to LoopOnly
- Keep for backward compatibility until full migration

Phase 142 P0: Statement-level normalization makes LoopWithPost obsolete

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
2025-12-19 04:39:25 +09:00
parent 21a3c6b5d4
commit aaba27d311

View File

@ -26,8 +26,21 @@ pub enum PlanKind {
/// Phase 132-133: loop(true) + post assignments + return /// Phase 132-133: loop(true) + post assignments + return
/// ///
/// **DEPRECATED in Phase 142 P0**: This variant is no longer created by PlanBox.
/// Normalization unit changed from "block suffix" to "statement (loop only)".
/// Post-loop assignments are now handled by normal MIR lowering, not normalization.
///
/// Migration: Use `LoopOnly` instead. Process subsequent statements separately.
///
/// This variant is kept for backward compatibility but will be removed
/// once all match arms and tests migrate to statement-level normalization.
///
/// Pattern: loop + N assignments + return /// Pattern: loop + N assignments + return
/// Example: `loop(true) { x = 1; break }; x = x + 2; return x` /// Example: `loop(true) { x = 1; break }; x = x + 2; return x`
#[deprecated(
since = "Phase 142 P0",
note = "Use LoopOnly instead. Normalization unit is now statement-level."
)]
LoopWithPost { LoopWithPost {
/// Number of post-loop assignment statements /// Number of post-loop assignment statements
post_assign_count: usize, post_assign_count: usize,
@ -45,6 +58,13 @@ impl NormalizationPlan {
} }
/// Create a Phase 132-133 plan (loop + post assignments + return) /// Create a Phase 132-133 plan (loop + post assignments + return)
///
/// **DEPRECATED in Phase 142 P0**: Use `loop_only()` instead.
/// Statement-level normalization makes this obsolete.
#[deprecated(
since = "Phase 142 P0",
note = "Use loop_only() instead. Statement-level normalization makes this obsolete."
)]
pub fn loop_with_post(post_assign_count: usize) -> Self { pub fn loop_with_post(post_assign_count: usize) -> Self {
// consumed = 1 (loop) + N (assigns) + 1 (return) // consumed = 1 (loop) + N (assigns) + 1 (return)
let consumed = 1 + post_assign_count + 1; let consumed = 1 + post_assign_count + 1;