Address PR comments, add syntax tests

This commit is contained in:
Sam Mohr 2024-10-21 03:06:43 -07:00
parent b3e60f9d3a
commit 7518a2c5ab
No known key found for this signature in database
GPG key ID: EA41D161A3C1BC99
28 changed files with 772 additions and 34 deletions

View file

@ -2640,7 +2640,13 @@ fn canonicalize_pending_body<'a>(
// The closure is self tail recursive iff it tail calls itself (by defined name).
let is_recursive = match can_output.tail_call {
Some(tail_symbol) if tail_symbol == *defined_symbol => Recursive::TailRecursive,
Some(tail_symbol) if tail_symbol == *defined_symbol => {
if closure_data.early_returns.is_empty() {
Recursive::TailRecursive
} else {
Recursive::Recursive
}
}
_ => Recursive::NotRecursive,
};