test(mir): fix test compilation after Call instruction callee field addition
Fixes test compilation errors caused by adding callee: Option<Callee> field to MirInstruction::Call in previous commits. Changes: - tests/mir_instruction_unit.rs: - Add callee: None to all Call instruction constructions - Ensures backward compatibility with existing tests - src/mir/instruction/tests.rs: - Add callee: None to Call instruction in phi_merge_if test - Maintains test correctness after Call signature change - src/mir/value_id.rs: - Add ValueId::INVALID constant (u32::MAX) - Provides clear sentinel value for invalid/placeholder IDs - src/mir/phi_core/loopform_builder.rs: - Replace deprecated ValueId::from() with ValueId::new() - Replace deprecated BasicBlockId::from() with BasicBlockId::new() - Ensures consistency with updated ID construction patterns Test Status: - Original errors from our commit: 6 → 0 ✅ - Remaining errors: 45 (pre-existing, unrelated to our changes) - 14: Missing interpreter module (legacy) - 11: Missing VM in backend::vm (moved) - 7: Missing jit module (archived) - 5: Missing MirInterpreter methods (legacy) - 4: Missing Box operator methods (pre-existing) All test errors related to LocalSSA and Call instruction changes are resolved. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@ -346,21 +346,21 @@ mod tests {
|
||||
#[test]
|
||||
fn test_sanitize_phi_inputs() {
|
||||
let mut inputs = vec![
|
||||
(BasicBlockId::from(1), ValueId::from(10)),
|
||||
(BasicBlockId::from(2), ValueId::from(20)),
|
||||
(BasicBlockId::from(1), ValueId::from(11)), // Duplicate, should override
|
||||
(BasicBlockId::new(1), ValueId::new(10)),
|
||||
(BasicBlockId::new(2), ValueId::new(20)),
|
||||
(BasicBlockId::new(1), ValueId::new(11)), // Duplicate, should override
|
||||
];
|
||||
sanitize_phi_inputs(&mut inputs);
|
||||
|
||||
assert_eq!(inputs.len(), 2);
|
||||
assert_eq!(inputs[0], (BasicBlockId::from(1), ValueId::from(11))); // Latest value
|
||||
assert_eq!(inputs[1], (BasicBlockId::from(2), ValueId::from(20)));
|
||||
assert_eq!(inputs[0], (BasicBlockId::new(1), ValueId::new(11))); // Latest value
|
||||
assert_eq!(inputs[1], (BasicBlockId::new(2), ValueId::new(20)));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_loopform_builder_separation() {
|
||||
let preheader = BasicBlockId::from(0);
|
||||
let header = BasicBlockId::from(1);
|
||||
let preheader = BasicBlockId::new(0);
|
||||
let header = BasicBlockId::new(1);
|
||||
let mut builder = LoopFormBuilder::new(preheader, header);
|
||||
|
||||
// Mock ops
|
||||
@ -380,7 +380,7 @@ mod tests {
|
||||
|
||||
impl LoopFormOps for MockOps {
|
||||
fn new_value(&mut self) -> ValueId {
|
||||
let id = ValueId::from(self.next_value);
|
||||
let id = ValueId::new(self.next_value);
|
||||
self.next_value += 1;
|
||||
id
|
||||
}
|
||||
@ -429,11 +429,11 @@ mod tests {
|
||||
|
||||
// Setup variables: me, limit (params), i, a, b (locals)
|
||||
let mut vars = HashMap::new();
|
||||
vars.insert("me".to_string(), ValueId::from(0));
|
||||
vars.insert("limit".to_string(), ValueId::from(1));
|
||||
vars.insert("i".to_string(), ValueId::from(2));
|
||||
vars.insert("a".to_string(), ValueId::from(3));
|
||||
vars.insert("b".to_string(), ValueId::from(4));
|
||||
vars.insert("me".to_string(), ValueId::new(0));
|
||||
vars.insert("limit".to_string(), ValueId::new(1));
|
||||
vars.insert("i".to_string(), ValueId::new(2));
|
||||
vars.insert("a".to_string(), ValueId::new(3));
|
||||
vars.insert("b".to_string(), ValueId::new(4));
|
||||
|
||||
// Prepare structure
|
||||
builder.prepare_structure(&mut ops, &vars).unwrap();
|
||||
@ -455,11 +455,11 @@ mod tests {
|
||||
// Verify deterministic allocation order
|
||||
// Expected: pinned first (me, limit), then carriers (i, a, b)
|
||||
// Each gets preheader_copy, header_phi sequentially
|
||||
assert_eq!(builder.pinned[0].preheader_copy, ValueId::from(100)); // me copy
|
||||
assert_eq!(builder.pinned[0].header_phi, ValueId::from(101)); // me phi
|
||||
assert_eq!(builder.pinned[1].preheader_copy, ValueId::from(102)); // limit copy
|
||||
assert_eq!(builder.pinned[1].header_phi, ValueId::from(103)); // limit phi
|
||||
assert_eq!(builder.carriers[0].preheader_copy, ValueId::from(104)); // i copy
|
||||
assert_eq!(builder.carriers[0].header_phi, ValueId::from(105)); // i phi
|
||||
assert_eq!(builder.pinned[0].preheader_copy, ValueId::new(100)); // me copy
|
||||
assert_eq!(builder.pinned[0].header_phi, ValueId::new(101)); // me phi
|
||||
assert_eq!(builder.pinned[1].preheader_copy, ValueId::new(102)); // limit copy
|
||||
assert_eq!(builder.pinned[1].header_phi, ValueId::new(103)); // limit phi
|
||||
assert_eq!(builder.carriers[0].preheader_copy, ValueId::new(104)); // i copy
|
||||
assert_eq!(builder.carriers[0].header_phi, ValueId::new(105)); // i phi
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user