diff --git a/src/mir/builder.rs b/src/mir/builder.rs index b45d988d..f4c1fe6a 100644 --- a/src/mir/builder.rs +++ b/src/mir/builder.rs @@ -734,7 +734,8 @@ impl MirBuilder { args.push(ty_id); args.extend(arg_vals); // Call env.box.new - let dst = self.value_gen.next(); + // 📦 Hotfix 3: Use next_value_id() to respect function parameter reservation + let dst = self.next_value_id(); self.emit_instruction(MirInstruction::ExternCall { dst: Some(dst), iface_name: "env.box".to_string(), @@ -755,7 +756,8 @@ impl MirBuilder { .. } = arguments[0].clone() { - let dst = self.value_gen.next(); + // 📦 Hotfix 3: Use next_value_id() to respect function parameter reservation + let dst = self.next_value_id(); self.emit_instruction(MirInstruction::Const { dst, value: ConstValue::Integer(n), @@ -773,7 +775,8 @@ impl MirBuilder { } // Generate the destination ValueId - let dst = self.value_gen.next(); + // 📦 Hotfix 3: Use next_value_id() to respect function parameter reservation + let dst = self.next_value_id(); // Emit NewBox instruction for all Box types // VM will handle optimization for basic types internally