From 09308649ed9a10727b6e543d76f311eaae70afc8 Mon Sep 17 00:00:00 2001 From: Adam Wick Date: Sat, 2 Mar 2024 22:05:53 -0800 Subject: [PATCH] remove dead test cases --- src/type_infer/convert.rs | 141 +------------------------------------- 1 file changed, 1 insertion(+), 140 deletions(-) diff --git a/src/type_infer/convert.rs b/src/type_infer/convert.rs index 0c2410a..80a572b 100644 --- a/src/type_infer/convert.rs +++ b/src/type_infer/convert.rs @@ -436,143 +436,4 @@ fn merge_prereq(left: &mut Vec, prereq: Option) { if let Some(item) = prereq { left.push(item) } -} - -#[cfg(test)] -mod tests { - // use super::*; - // use crate::syntax::Location; - // - // fn one() -> syntax::Expression { - // syntax::Expression::Value( - // Location::manufactured(), - // syntax::Value::Number(None, None, 1), - // ) - // } - // - // fn vec_contains bool>(x: &[T], f: F) -> bool { - // for x in x.iter() { - // if f(x) { - // return true; - // } - // } - // false - // } - // - // fn infer_expression( - // x: syntax::Expression, - // ) -> (ir::Expression, Vec, Vec, Type) { - // let mut constraints = Vec::new(); - // let renames = HashMap::new(); - // let mut bindings = HashMap::new(); - // let (stmts, expr, ty) = convert_expression(x, &mut constraints, &renames, &mut bindings); - // (expr, stmts, constraints, ty) - // } - // - // fn infer_top_level(x: syntax::TopLevel) -> (Vec, Vec) { - // let mut constraints = Vec::new(); - // let mut renames = HashMap::new(); - // let mut bindings = HashMap::new(); - // let res = convert_top_level(x, &mut constraints, &mut renames, &mut bindings); - // (res, constraints) - // } - // - // #[test] - // fn constant_one() { - // let (expr, stmts, constraints, ty) = infer_expression(one()); - // assert!(stmts.is_empty()); - // assert!(matches!( - // expr, - // ir::Expression::Atomic(ir::ValueOrRef::Value(_, _, ir::Value::Unknown(None, 1))) - // )); - // assert!(vec_contains(&constraints, |x| matches!( - // x, - // Constraint::FitsInNumType(_, _, 1) - // ))); - // assert!(vec_contains( - // &constraints, - // |x| matches!(x, Constraint::ConstantNumericType(_, t) if t == &ty) - // )); - // } - // - // #[test] - // fn one_plus_one() { - // let opo = syntax::Expression::Primitive( - // Location::manufactured(), - // "+".to_string(), - // vec![one(), one()], - // ); - // let (expr, stmts, constraints, ty) = infer_expression(opo); - // assert!(stmts.is_empty()); - // assert!(matches!(expr, ir::Expression::Primitive(_, t, ir::Primitive::Plus, _) if t == ty)); - // assert!(vec_contains(&constraints, |x| matches!( - // x, - // Constraint::FitsInNumType(_, _, 1) - // ))); - // assert!(vec_contains( - // &constraints, - // |x| matches!(x, Constraint::ConstantNumericType(_, t) if t != &ty) - // )); - // assert!(vec_contains( - // &constraints, - // |x| matches!(x, Constraint::ProperPrimitiveArgs(_, ir::Primitive::Plus, args, ret) if args.len() == 2 && ret == &ty) - // )); - // } - // - // #[test] - // fn one_plus_one_plus_one() { - // let stmt = syntax::TopLevel::parse(1, "x = 1 + 1 + 1;").expect("basic parse"); - // let (stmts, constraints) = infer_top_level(stmt); - // assert_eq!(stmts.len(), 2); - // let ir::TopLevel::Statement(ir::Statement::Binding( - // _args, - // name1, - // temp_ty1, - // ir::Expression::Primitive(_, primty1, ir::Primitive::Plus, primargs1), - // )) = stmts.get(0).expect("item two") - // else { - // panic!("Failed to match first statement"); - // }; - // let ir::TopLevel::Statement(ir::Statement::Binding( - // _args, - // name2, - // temp_ty2, - // ir::Expression::Primitive(_, primty2, ir::Primitive::Plus, primargs2), - // )) = stmts.get(1).expect("item two") - // else { - // panic!("Failed to match second statement"); - // }; - // let &[ir::ValueOrRef::Value(_, ref left1ty, _), ir::ValueOrRef::Value(_, ref right1ty, _)] = - // &primargs1[..] - // else { - // panic!("Failed to match first arguments"); - // }; - // let &[ir::ValueOrRef::Ref(_, _, ref left2name), ir::ValueOrRef::Value(_, ref right2ty, _)] = - // &primargs2[..] - // else { - // panic!("Failed to match first arguments"); - // }; - // assert_ne!(name1, name2); - // assert_ne!(temp_ty1, temp_ty2); - // assert_ne!(primty1, primty2); - // assert_eq!(name1, left2name); - // assert!(vec_contains( - // &constraints, - // |x| matches!(x, Constraint::ConstantNumericType(_, t) if t == left1ty) - // )); - // assert!(vec_contains( - // &constraints, - // |x| matches!(x, Constraint::ConstantNumericType(_, t) if t == right1ty) - // )); - // assert!(vec_contains( - // &constraints, - // |x| matches!(x, Constraint::ConstantNumericType(_, t) if t == right2ty) - // )); - // for (i, s) in stmts.iter().enumerate() { - // println!("{}: {:?}", i, s); - // } - // for (i, c) in constraints.iter().enumerate() { - // println!("{}: {:?}", i, c); - // } - // } -} +} \ No newline at end of file