Revise desugaring following feedback

- We now consistently desugar an expect in the last position as
    `Void`. Regardless of the pattern. Desugaring to a boolean value is
    deemed too confusing.

  - This commit also removes the desugaring for let-binding. It's only
    ever allowed for _expect_ which then behaves like a side effect.

  - We also now allow tests to return either `Bool` or `Void`. A test
    that returns `Void` is treated the same as a test returning `True`.
This commit is contained in:
KtorZ
2024-08-21 14:31:57 +02:00
parent fbe6f02fd1
commit 9aa9070f56
13 changed files with 196 additions and 128 deletions

View File

@@ -39,7 +39,11 @@ impl EvalResult {
} else {
self.result.is_err()
|| matches!(self.result, Ok(Term::Error))
|| !matches!(self.result, Ok(Term::Constant(ref con)) if matches!(con.as_ref(), Constant::Bool(true)))
|| !matches!(
self.result,
Ok(Term::Constant(ref con))
if matches!(con.as_ref(), Constant::Bool(true)) || matches!(con.as_ref(), Constant::Unit)
)
}
}