Allow UnusedDef problems in solve tests

This commit is contained in:
Richard Feldman 2020-04-05 22:37:03 -04:00
parent 20f7243373
commit 41662af399
2 changed files with 16 additions and 2 deletions

View File

@ -31,7 +31,7 @@ mod test_solve {
constraint,
home,
interns,
problems: can_problems,
problems: mut can_problems,
..
} = can_expr(src);
let mut subs = Subs::new(var_store.into());
@ -49,6 +49,13 @@ mod test_solve {
let actual_str = content_to_string(content, &mut subs, home, &interns);
// Disregard UnusedDef problems, because those are unavoidable when
// returning a function from the test expression.
can_problems.retain(|prob| match prob {
roc_problem::can::Problem::UnusedDef(_, _) => false,
_ => true,
});
(unify_problems, can_problems, actual_str)
}

View File

@ -17,9 +17,16 @@ mod test_uniq_solve {
// HELPERS
fn infer_eq_help(src: &str) -> (Vec<roc_solve::solve::TypeError>, String) {
let (_loc_expr, output, can_problems, mut subs, variable, constraint, home, interns) =
let (_loc_expr, output, mut can_problems, mut subs, variable, constraint, home, interns) =
uniq_expr(src);
// Disregard UnusedDef problems, because those are unavoidable when
// returning a function from the test expression.
can_problems.retain(|prob| match prob {
roc_problem::can::Problem::UnusedDef(_, _) => false,
_ => true,
});
assert_eq!(can_problems, Vec::new(), "Canonicalization problems");
assert_correct_variable_usage(&constraint);