Merge pull request #2917 from rtfeldman/move-exhaustiveness-checking

Moves exhaustiveness checking to type solving phase
This commit is contained in:
Richard Feldman 2022-04-25 20:55:05 -04:00 committed by GitHub
commit 6da39aa296
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 1067 additions and 177 deletions

View file

@ -2091,6 +2091,7 @@ fn pattern_to_when<'a>(
value: body,
guard: None,
}],
branches_cond_var: pattern_var,
};
(symbol, Loc::at_zero(wrapped_body))
@ -3753,6 +3754,7 @@ pub fn with_hole<'a>(
region,
loc_cond,
branches,
branches_cond_var: _,
} => {
let cond_symbol = possible_reuse_symbol(env, procs, &loc_cond.value);
@ -5443,6 +5445,7 @@ pub fn from_can<'a>(
region,
loc_cond,
branches,
branches_cond_var: _,
} => {
let cond_symbol = possible_reuse_symbol(env, procs, &loc_cond.value);
@ -5844,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();
@ -5874,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?