support for more trailing !

This commit is contained in:
Luke Boswell 2024-04-22 18:38:51 +10:00
parent 32c4083364
commit aa5dc09900
No known key found for this signature in database
GPG key ID: F6DB3C9DB47377B0

View file

@ -857,15 +857,21 @@ fn is_matching_empty_record<'a>(
is_empty_record && is_pattern_empty_record
}
fn is_matching_intermediate_answer<'a>(
pub fn is_matching_intermediate_answer<'a>(
loc_pat: &'a Loc<Pattern<'a>>,
loc_expr: &'a Loc<Expr<'a>>,
loc_new: &'a Loc<Expr<'a>>,
) -> bool {
let pat_ident = match loc_pat.value {
Pattern::Identifier { ident, .. } => Some(ident),
_ => None,
};
let exp_ident = match extract_wrapped_task_ok_value(loc_expr) {
let exp_iten = match loc_new.value {
Expr::Var {
module_name, ident, ..
} if module_name.is_empty() && ident.starts_with('#') => Some(ident),
_ => None,
};
let exp_ident_in_task = match extract_wrapped_task_ok_value(loc_new) {
Some(task_expr) => match task_expr.value {
Expr::Var {
module_name, ident, ..
@ -874,8 +880,9 @@ fn is_matching_intermediate_answer<'a>(
},
None => None,
};
match (pat_ident, exp_ident) {
(Some(a), Some(b)) => a == b,
match (pat_ident, exp_iten, exp_ident_in_task) {
(Some(a), Some(b), None) => a == b,
(Some(a), None, Some(b)) => a == b,
_ => false,
}
}