refactor(joinir): unify boundary join_inputs SSOT (pattern4/6/7)
Apply Phase 256.8 SSOT fix to Pattern4/6/7: - Use join_module.entry.params.clone() instead of hardcoded ValueIds - Add fail-fast validation for params count mismatch - Remove ValueId(0), ValueId(PARAM_MIN + k) patterns - Clean up unused PARAM_MIN imports This prevents entry_param_mismatch errors structurally and maintains consistency with Pattern2/3. Changes: - pattern4_with_continue.rs: Lines 442-476 (SSOT extraction + validation) - pattern6_scan_with_init.rs: Lines 447-471 (SSOT extraction + validation) - pattern7_split_scan.rs: Lines 495-526 (SSOT extraction + validation) All patterns now use the same SSOT principle: 1. Extract entry function (priority: join_module.entry → fallback "main") 2. Use params as SSOT: join_inputs = entry_func.params.clone() 3. Build host_inputs in expected order (pattern-specific) 4. Fail-fast validation: join_inputs.len() == host_inputs.len() Verification: - cargo build --release: ✅ PASS (no PARAM_MIN warnings) - Quick profile: ✅ First FAIL still json_lint_vm (baseline maintained) - Pattern6 smoke: ✅ PASS (index_of test) - Pattern7 smoke: Pre-existing phi pred mismatch (not introduced by SSOT) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@ -15,7 +15,7 @@
|
||||
//! **Fail-Safe**: Unsupported AST nodes return explicit errors, allowing callers
|
||||
//! to fall back to legacy paths.
|
||||
|
||||
use super::condition_lowerer::lower_condition_to_joinir_no_body_locals;
|
||||
use super::condition_lowerer::{lower_condition_to_joinir, lower_condition_to_joinir_no_body_locals};
|
||||
use super::scope_manager::ScopeManager;
|
||||
use crate::ast::ASTNode;
|
||||
use crate::mir::builder::MirBuilder;
|
||||
@ -296,9 +296,15 @@ impl<'env, 'builder, S: ScopeManager> ConditionLoweringBox<S> for ExprLowerer<'e
|
||||
.map_err(|e| e.to_string())?;
|
||||
|
||||
// Delegate to the well-tested lowerer, but use the caller-provided allocator (SSOT).
|
||||
let (result_value, instructions) =
|
||||
lower_condition_to_joinir_no_body_locals(condition, &mut *context.alloc_value, &condition_env) // Phase 92 P2-2
|
||||
.map_err(|e| e.to_string())?;
|
||||
// Phase 256.7: Pass current_static_box_name for this.method(...) support
|
||||
let (result_value, instructions) = lower_condition_to_joinir(
|
||||
condition,
|
||||
&mut *context.alloc_value,
|
||||
&condition_env,
|
||||
None, // body_local_env
|
||||
context.current_static_box_name.as_deref(), // Phase 256.7
|
||||
)
|
||||
.map_err(|e| e.to_string())?;
|
||||
|
||||
self.last_instructions = instructions;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user