fix: case where identity function was used as a param.

This was causing a free unique. The fix is after stripping applied usage of identity,
we then check if it is passed around and if so we leave in the function declaration.
This commit is contained in:
microproofs
2023-05-16 16:21:37 -04:00
parent d6afaa7540
commit 340ed3b6a5

View File

@@ -235,7 +235,13 @@ fn inline_identity_reduce(term: &mut Term<Name>) {
};
if identity_var.as_ref() == identity_name.as_ref() {
*term = replace_identity_usage(body, parameter_name.clone());
let temp_term = replace_identity_usage(body, parameter_name.clone());
if var_occurrences(body, parameter_name.clone()) > 0 {
let body = Rc::make_mut(body);
*body = temp_term;
} else {
*term = temp_term;
}
}
}
Term::Force(f) => {