mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 06:14:46 +00:00
Fought against clippy and lost
This commit is contained in:
parent
7d908dc99c
commit
17e7b10267
3 changed files with 14 additions and 9 deletions
|
@ -722,7 +722,7 @@ pub fn constrain_expr(
|
|||
pattern_cons.push(expr_con);
|
||||
|
||||
// Now check the condition against the type expected by the branches.
|
||||
let sketched_rows = sketch_rows(real_cond_var, branches_region, &branches);
|
||||
let sketched_rows = sketch_rows(real_cond_var, branches_region, branches);
|
||||
let cond_matches_branches_constraint = constraints.exhaustive(
|
||||
real_cond_var,
|
||||
loc_cond.region,
|
||||
|
|
|
@ -5847,7 +5847,7 @@ fn to_opt_branches<'a>(
|
|||
Ok((mono_pattern, assignments)) => {
|
||||
loc_branches.push((
|
||||
Loc::at(loc_pattern.region, mono_pattern.clone()),
|
||||
exhaustive_guard.clone(),
|
||||
exhaustive_guard,
|
||||
));
|
||||
|
||||
let mut loc_expr = when_branch.value.clone();
|
||||
|
@ -5877,7 +5877,7 @@ fn to_opt_branches<'a>(
|
|||
Err(runtime_error) => {
|
||||
loc_branches.push((
|
||||
Loc::at(loc_pattern.region, Pattern::Underscore),
|
||||
exhaustive_guard.clone(),
|
||||
exhaustive_guard,
|
||||
));
|
||||
|
||||
// TODO remove clone?
|
||||
|
|
|
@ -1222,11 +1222,16 @@ fn solve(
|
|||
|
||||
let real_content = subs.get_content_without_compacting(real_var);
|
||||
let branches_content = subs.get_content_without_compacting(branches_var);
|
||||
let already_have_error = match (real_content, branches_content) {
|
||||
(Content::Error | Content::Structure(FlatType::Erroneous(_)), _) => true,
|
||||
(_, Content::Error | Content::Structure(FlatType::Erroneous(_))) => true,
|
||||
_ => false,
|
||||
};
|
||||
let already_have_error = matches!(
|
||||
(real_content, branches_content),
|
||||
(
|
||||
Content::Error | Content::Structure(FlatType::Erroneous(_)),
|
||||
_
|
||||
) | (
|
||||
_,
|
||||
Content::Error | Content::Structure(FlatType::Erroneous(_))
|
||||
)
|
||||
);
|
||||
|
||||
let snapshot = subs.snapshot();
|
||||
let outcome = unify(subs, real_var, branches_var, Mode::EQ);
|
||||
|
@ -1303,7 +1308,7 @@ fn solve(
|
|||
let sketched_rows = constraints.sketched_rows[sketched_rows.index()].clone();
|
||||
|
||||
if should_check_exhaustiveness {
|
||||
let checked = roc_can::exhaustive::check(&subs, sketched_rows, context);
|
||||
let checked = roc_can::exhaustive::check(subs, sketched_rows, context);
|
||||
if let Err(errors) = checked {
|
||||
problems.extend(errors.into_iter().map(TypeError::Exhaustive));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue