refactor(joinir): Phase 86 - Carrier init builder, debug migration, error tags
P1: Carrier Initialization Builder (HIGH) ✅ - New module: carrier_init_builder.rs (197 lines, 8 tests) - Refactored loop_header_phi_builder.rs (-34 lines) - Centralized CarrierInit value generation (SSOT) - Eliminates scattered match patterns across header PHI, exit line - Consistent debug output: [carrier_init_builder] format - Net: -34 lines of duplicated logic P2: Remaining DebugOutputBox Migration (QUICK) ✅ - Migrated carrier_info.rs::record_promoted_binding() - Uses DebugOutputBox for JOINIR_DEBUG checks - Maintains JOINIR_TEST_DEBUG override for test diagnostics - Consistent log formatting: [context/category] message - Net: +3 lines (SSOT migration) P3: Error Message Centralization (LOW) ✅ - New module: error_tags.rs (136 lines, 5 tests) - Migrated 3 error sites: * ownership/relay:runtime_unsupported (plan_validator.rs) * joinir/freeze (control_flow/mod.rs) * (ExitLine errors were debug messages, not returns) - Centralized error tag generation (freeze, exit_line_contract, ownership_relay_unsupported, etc.) - Net: +133 lines (SSOT module + tests) Total changes: - New files: carrier_init_builder.rs (197), error_tags.rs (136) - Modified: 6 files - Production code: +162 lines (SSOT investment) - Tests: 987/987 PASS (982→987, +5 new tests) - Phase 81 ExitLine: 2/2 PASS - Zero compilation errors/warnings Benefits: ✅ Single Responsibility: Each helper has one concern ✅ Testability: 13 new unit tests (8 carrier init, 5 error tags) ✅ Consistency: Uniform debug/error formatting ✅ SSOT: Centralized CarrierInit and error tag generation ✅ Discoverability: Easy to find all error types 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@ -110,12 +110,13 @@ impl super::MirBuilder {
|
||||
|
||||
// Phase 186: LoopBuilder Hard Freeze - Legacy path disabled
|
||||
// Phase 187-2: LoopBuilder module removed - all loops must use JoinIR
|
||||
return Err(format!(
|
||||
"[joinir/freeze] Loop lowering failed: JoinIR does not support this pattern, and LoopBuilder has been removed.\n\
|
||||
use crate::mir::join_ir::lowering::error_tags;
|
||||
return Err(error_tags::freeze(&format!(
|
||||
"Loop lowering failed: JoinIR does not support this pattern, and LoopBuilder has been removed.\n\
|
||||
Function: {}\n\
|
||||
Hint: This loop pattern is not supported. All loops must use JoinIR lowering.",
|
||||
self.current_function.as_ref().map(|f| f.signature.name.as_str()).unwrap_or("<unknown>")
|
||||
));
|
||||
)));
|
||||
}
|
||||
|
||||
/// Phase 49: Try JoinIR Frontend for mainline integration
|
||||
|
||||
Reference in New Issue
Block a user