Reduce unused warnings in tests and helpers
This commit is contained in:
@ -105,8 +105,6 @@ impl Frag {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::mir::basic_block::EdgeArgs;
|
||||
use crate::mir::join_ir::lowering::inline_boundary::JumpArgsLayout;
|
||||
|
||||
#[test]
|
||||
fn test_frag_basic_construction() {
|
||||
|
||||
@ -33,7 +33,7 @@ pub(super) fn prebuild_header_phis(
|
||||
let trace = super::trace::trace();
|
||||
|
||||
// Build loop header PHI info if we have a boundary with loop_var_name
|
||||
let (mut loop_header_phi_info, merge_entry_block) = if let Some(boundary) = boundary {
|
||||
let (loop_header_phi_info, merge_entry_block) = if let Some(boundary) = boundary {
|
||||
if let Some(loop_var_name) = &boundary.loop_var_name {
|
||||
// Phase 287 P0.4: Delegate entry selection to entry_selector (SSOT)
|
||||
let loop_step_func_name =
|
||||
|
||||
@ -97,7 +97,6 @@ impl MirBuilder {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::ast::{ASTNode, BinaryOperator, LiteralValue, Span};
|
||||
|
||||
/// Test helper: Create a skip_whitespace pattern loop AST
|
||||
|
||||
@ -57,17 +57,16 @@ use pattern_recognizers::carrier_count::count_carriers_in_body;
|
||||
|
||||
// Re-export parse_number pattern detection
|
||||
pub use pattern_recognizers::parse_number::{
|
||||
detect_parse_number_pattern, detect_read_digits_loop_true_pattern, ParseNumberInfo,
|
||||
ReadDigitsLoopTrueInfo,
|
||||
detect_parse_number_pattern, detect_read_digits_loop_true_pattern,
|
||||
};
|
||||
|
||||
// Re-export parse_string pattern detection
|
||||
pub use pattern_recognizers::parse_string::{
|
||||
detect_continue_pattern, detect_parse_string_pattern, ContinuePatternInfo, ParseStringInfo,
|
||||
detect_continue_pattern, detect_parse_string_pattern,
|
||||
};
|
||||
|
||||
// Re-export skip_whitespace pattern detection
|
||||
pub use pattern_recognizers::skip_whitespace::{detect_skip_whitespace_pattern, SkipWhitespaceInfo};
|
||||
pub use pattern_recognizers::skip_whitespace::detect_skip_whitespace_pattern;
|
||||
|
||||
// Re-export escape pattern recognizer (existing module, not moved in P1)
|
||||
pub use super::escape_pattern_recognizer::detect_escape_skip_pattern;
|
||||
|
||||
@ -22,7 +22,7 @@ pub(in crate::mir::builder) fn try_promote(
|
||||
body: &[ASTNode],
|
||||
inputs: Pattern2Inputs,
|
||||
debug: bool,
|
||||
verbose: bool,
|
||||
_verbose: bool,
|
||||
) -> Result<PromoteDecision, String> {
|
||||
let mut inputs = inputs;
|
||||
use crate::mir::join_ir::lowering::digitpos_condition_normalizer::DigitPosConditionNormalizer;
|
||||
|
||||
@ -484,8 +484,3 @@ fn extract_scan_with_init_parts(
|
||||
|
||||
// Phase 273 P0.1: cf_loop_pattern6_scan_with_init_impl() removed (migrated to plan/lowerer.rs)
|
||||
// The implementation is now in PlanLowerer::lower_scan_with_init()
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
}
|
||||
|
||||
@ -398,7 +398,7 @@ pub(crate) fn lower(
|
||||
let ret_false_bb = builder.next_block_id();
|
||||
|
||||
// Add Jump from current block to header_bb (to terminate the previous block)
|
||||
if let Some(current) = builder.current_block {
|
||||
if let Some(_current) = builder.current_block {
|
||||
builder.emit_instruction(MirInstruction::Jump {
|
||||
target: header_bb,
|
||||
edge_args: None,
|
||||
|
||||
@ -103,7 +103,6 @@ impl NormalizedShadowSuffixRouterBox {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::ast::{ASTNode, LiteralValue, Span};
|
||||
|
||||
#[test]
|
||||
|
||||
@ -515,10 +515,10 @@ impl TrimLoopLowerer {
|
||||
/// 1. Carrier variable (e.g., "is_ch_match")
|
||||
/// 2. Original variable (e.g., "ch") - mapped to same JoinIR ValueId
|
||||
fn setup_condition_env_bindings(
|
||||
builder: &mut MirBuilder,
|
||||
_builder: &mut MirBuilder,
|
||||
trim_helper: &crate::mir::loop_pattern_detection::trim_loop_helper::TrimLoopHelper,
|
||||
break_semantics: BreakSemantics,
|
||||
alloc_join_value: &mut dyn FnMut() -> ValueId,
|
||||
_alloc_join_value: &mut dyn FnMut() -> ValueId,
|
||||
) -> Result<(Vec<ConditionBinding>, Option<crate::mir::join_ir::lowering::common::condition_only_emitter::ConditionOnlyRecipe>), String> {
|
||||
|
||||
use crate::mir::join_ir::lowering::common::condition_only_emitter::ConditionOnlyRecipe;
|
||||
|
||||
@ -183,7 +183,7 @@ impl JoinIrIdRemapper {
|
||||
then_val,
|
||||
else_val,
|
||||
} => vec![*dst, *cond, *then_val, *else_val],
|
||||
Jump { .. } | Nop | Safepoint => vec![],
|
||||
Nop | Safepoint => vec![],
|
||||
ExternCall { dst, args, .. } => {
|
||||
let mut vals = Vec::new();
|
||||
if let Some(d) = dst {
|
||||
|
||||
@ -89,7 +89,7 @@ impl AnfExecuteBox {
|
||||
/// This function recursively normalizes left and right operands (depth-first, left-to-right)
|
||||
/// and then generates a pure BinaryOp instruction.
|
||||
fn execute_binary_op_hoist(
|
||||
plan: &AnfPlan,
|
||||
_plan: &AnfPlan,
|
||||
ast: &ASTNode,
|
||||
env: &mut BTreeMap<String, ValueId>,
|
||||
body: &mut Vec<JoinInst>,
|
||||
@ -295,7 +295,7 @@ impl AnfExecuteBox {
|
||||
/// This function recursively normalizes left and right operands (depth-first, left-to-right)
|
||||
/// and then generates a pure Compare instruction.
|
||||
fn execute_compare_hoist(
|
||||
plan: &AnfPlan,
|
||||
_plan: &AnfPlan,
|
||||
ast: &ASTNode,
|
||||
env: &mut BTreeMap<String, ValueId>,
|
||||
body: &mut Vec<JoinInst>,
|
||||
|
||||
@ -223,7 +223,7 @@ impl AnfPlanBox {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::ast::{ASTNode, BinaryOperator, LiteralValue, UnaryOperator};
|
||||
use crate::ast::{ASTNode, BinaryOperator, LiteralValue};
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
fn span() -> crate::ast::Span {
|
||||
|
||||
@ -83,7 +83,6 @@ impl AvailableInputsCollectorBox {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::mir::loop_pattern_detection::function_scope_capture::CapturedVar;
|
||||
|
||||
#[test]
|
||||
fn test_collect_empty() {
|
||||
|
||||
@ -58,7 +58,7 @@ use crate::mir::join_ir::{JoinFunction, JoinFuncId, JoinInst, JoinModule};
|
||||
use crate::mir::ValueId;
|
||||
|
||||
#[cfg(test)]
|
||||
use crate::mir::join_ir::{BinOpKind, ConstValue, MirLikeInst};
|
||||
use crate::mir::join_ir::{ConstValue, MirLikeInst};
|
||||
#[cfg(test)]
|
||||
use crate::mir::join_ir_vm_bridge::join_func_name;
|
||||
#[cfg(test)]
|
||||
|
||||
@ -387,7 +387,7 @@ impl StepTreeBuilderBox {
|
||||
},
|
||||
_ => None,
|
||||
},
|
||||
/// Phase 128: Store value AST for Normalized lowering
|
||||
// Phase 128: Store value AST for Normalized lowering
|
||||
value_ast: Some(AstNodeHandle(value.clone())),
|
||||
},
|
||||
span: span.clone(),
|
||||
|
||||
@ -256,7 +256,6 @@ mod tests {
|
||||
use super::*;
|
||||
use crate::mir::join_ir::lowering::condition_env::ConditionEnv;
|
||||
use crate::mir::join_ir::lowering::loop_body_local_env::LoopBodyLocalEnv;
|
||||
use crate::mir::join_ir::JoinInst;
|
||||
use crate::mir::ValueId;
|
||||
|
||||
#[test]
|
||||
|
||||
@ -327,8 +327,6 @@ fn has_break_or_continue(_loop_form: &LoopForm) -> bool {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
#[ignore] // TODO: Implement test after lowering logic is complete
|
||||
fn test_pattern6_lowering_success() {
|
||||
|
||||
@ -556,6 +556,7 @@ mod tests {
|
||||
assert_eq!(args[1], ValueId(11)); // ch argument
|
||||
}
|
||||
_ => panic!("Expected BoxCall instruction"),
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -601,7 +602,6 @@ mod tests {
|
||||
assert_eq!(boxcall, vec![ValueId(1), ValueId(2)]);
|
||||
assert!(result.0 >= 100);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_lower_substring_with_args() {
|
||||
|
||||
@ -213,7 +213,7 @@ where
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::mir::{BasicBlock, ConstValue, EffectMask, MirType, FunctionSignature};
|
||||
use crate::mir::{ConstValue, EffectMask, MirType, FunctionSignature};
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
/// Helper: Create empty MirFunction for testing
|
||||
|
||||
@ -232,9 +232,8 @@ where
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::mir::function::{FunctionMetadata, FunctionSignature, MirFunction};
|
||||
use crate::mir::{BasicBlock, BasicBlockId, MirInstruction, ValueId};
|
||||
use std::collections::HashMap;
|
||||
use crate::mir::function::{FunctionSignature, MirFunction};
|
||||
use crate::mir::{BasicBlockId, MirInstruction, ValueId};
|
||||
|
||||
/// Mock finalize function for testing
|
||||
fn mock_finalize(
|
||||
|
||||
@ -321,9 +321,8 @@ where
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::mir::function::{FunctionMetadata, FunctionSignature, MirFunction};
|
||||
use crate::mir::{BasicBlock, BasicBlockId, MirInstruction, ValueId};
|
||||
use std::collections::HashMap;
|
||||
use crate::mir::function::{FunctionSignature, MirFunction};
|
||||
use crate::mir::{BasicBlockId, MirInstruction, ValueId};
|
||||
|
||||
/// Mock finalize function for testing
|
||||
fn mock_finalize(
|
||||
|
||||
@ -35,8 +35,7 @@ where
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::ast::Span;
|
||||
use crate::mir::{BasicBlock, FunctionSignature, MirType, EffectMask};
|
||||
use crate::mir::{FunctionSignature, MirType, EffectMask};
|
||||
|
||||
#[test]
|
||||
fn test_handle_ret_with_value() {
|
||||
|
||||
@ -604,12 +604,12 @@ impl JoinIrBlockConverter {
|
||||
|
||||
fn handle_select(
|
||||
&mut self,
|
||||
mir_func: &mut MirFunction,
|
||||
_mir_func: &mut MirFunction,
|
||||
dst: &ValueId,
|
||||
cond: &ValueId,
|
||||
then_val: &ValueId,
|
||||
else_val: &ValueId,
|
||||
type_hint: &Option<crate::mir::MirType>,
|
||||
_type_hint: &Option<crate::mir::MirType>,
|
||||
) -> Result<(), JoinIrVmBridgeError> {
|
||||
// Phase 256 P1.5: Select → MirInstruction::Select (direct instruction, not control flow expansion)
|
||||
debug_log!(
|
||||
|
||||
@ -18,7 +18,7 @@ pub(crate) fn try_parse_header_first_field_or_property(
|
||||
fname: String,
|
||||
methods: &mut HashMap<String, ASTNode>,
|
||||
fields: &mut Vec<String>,
|
||||
weak_fields: &mut Vec<String>,
|
||||
_weak_fields: &mut Vec<String>,
|
||||
) -> Result<bool, ParseError> {
|
||||
// Expect ':' Type after name
|
||||
if !p.match_token(&TokenType::COLON) {
|
||||
|
||||
@ -426,7 +426,7 @@ pub fn emit_mir_json_for_harness(
|
||||
obj["dst_type"] = t;
|
||||
}
|
||||
insts.push(obj);
|
||||
if let Some(d) = dst.map(|v| v.as_u32()) {}
|
||||
if let Some(_d) = dst.map(|v| v.as_u32()) {}
|
||||
}
|
||||
_ => {
|
||||
// Other callee types: emit generic call
|
||||
@ -504,7 +504,7 @@ pub fn emit_mir_json_for_harness(
|
||||
obj["dst_type"] = t;
|
||||
}
|
||||
insts.push(obj);
|
||||
if let Some(d) = dst.map(|v| v.as_u32()) {}
|
||||
if let Some(_d) = dst.map(|v| v.as_u32()) {}
|
||||
}
|
||||
I::NewBox {
|
||||
dst,
|
||||
@ -872,7 +872,7 @@ pub fn emit_mir_json_for_harness_bin(
|
||||
obj["dst_type"] = t;
|
||||
}
|
||||
insts.push(obj);
|
||||
if let Some(d) = dst.map(|v| v.as_u32()) {}
|
||||
if let Some(_d) = dst.map(|v| v.as_u32()) {}
|
||||
}
|
||||
_ => {
|
||||
// Other callee types: emit generic call
|
||||
@ -906,7 +906,7 @@ pub fn emit_mir_json_for_harness_bin(
|
||||
}
|
||||
}
|
||||
insts.push(obj);
|
||||
if let Some(d) = dst.map(|v| v.as_u32()) {}
|
||||
if let Some(_d) = dst.map(|v| v.as_u32()) {}
|
||||
}
|
||||
I::BoxCall {
|
||||
dst,
|
||||
@ -941,7 +941,7 @@ pub fn emit_mir_json_for_harness_bin(
|
||||
obj["dst_type"] = t;
|
||||
}
|
||||
insts.push(obj);
|
||||
if let Some(d) = dst.map(|v| v.as_u32()) {}
|
||||
if let Some(_d) = dst.map(|v| v.as_u32()) {}
|
||||
}
|
||||
I::NewBox {
|
||||
dst,
|
||||
|
||||
@ -31,7 +31,10 @@ impl NyashRunner {
|
||||
let code = match fs::read_to_string(filename) {
|
||||
Ok(content) => content,
|
||||
Err(e) => {
|
||||
report::emit_error_and_exit(LlvmRunError::fatal(format!("Error reading file {}: {}", filename, e)));
|
||||
report::emit_error_and_exit(LlvmRunError::fatal(format!(
|
||||
"Error reading file {}: {}",
|
||||
filename, e
|
||||
)));
|
||||
}
|
||||
};
|
||||
|
||||
@ -182,7 +185,7 @@ impl NyashRunner {
|
||||
// Execute via LLVM backend (harness preferred)
|
||||
match harness_executor::HarnessExecutorBox::try_execute(&module) {
|
||||
Ok(code) => exit_reporter::ExitReporterBox::emit_and_exit(code),
|
||||
Err(e) => {
|
||||
Err(_e) => {
|
||||
// If harness failed, try fallback path
|
||||
match fallback_executor::FallbackExecutorBox::execute(&module) {
|
||||
Ok(code) => exit_reporter::ExitReporterBox::emit_and_exit(code),
|
||||
|
||||
Reference in New Issue
Block a user